hw/loongarch/virt: Fix UART ACPI description and update DSDT blobs
v3 cover hw/loongarch/virt: Fix UART ACPI description and update DSDT blobs
The LoongArch virt UART ACPI description currently carries a _DSD clock property with a typo ("clock-frenquency"), a reversed key/value order, and a declared 100 MHz that does not match the QEMU model. The _DSD contains nothing but this clock property, so the whole object is dropped.
The Linux PNP serial driver uses uartclk = 1843200 Hz by default and the QEMU UART uses baudbase = 115200, i.e. uartclk / 16 = baudbase, so the Linux default clock already matches the model. QEMU's x86 ISA serial ACPI description also provides no clock property, which is consistent with this change.
Two further cleanups are folded into the same patch: _CCA is dropped because the emulated UART does not support DMA, and _STA = 0x0f is added to indicate the device is present, enabled, should be shown and functioning properly.
Patch 1 allows the LoongArch DSDT.* diffs in bios-tables-test, patch 2 makes the ACPI change, and patch 3 refreshes the expected DSDT blobs.
Testing: ran bios-tables-test with the updated blobs; no unexpected diffs remain.
pillow (3):
bios-tables-test-allowed-diff.h: Allow LoongArch DSDT.* hw/loongarch/virt: Drop UART _DSD/_CCA and add _STA tests/data/acpi/loongarch64: Update expected DSDT.*
hw/loongarch/virt-acpi-build.c | 12 +----------- tests/data/acpi/loongarch64/virt/DSDT | Bin 4603 -> 4379 bytes tests/data/acpi/loongarch64/virt/DSDT.memhp | Bin 5824 -> 5600 bytes tests/data/acpi/loongarch64/virt/DSDT.numamem | Bin 4609 -> 4385 bytes .../data/acpi/loongarch64/virt/DSDT.topology | Bin 4905 -> 4681 bytes 5 files changed, 1 insertion(+), 11 deletions(-)
base-commit: 8967b2fe1b2aaae3c29e207d85fab901d580a2dc
Signature · 1 line
2.56.0
PATCH v3 2/3 hw/loongarch/virt: Drop UART _DSD/_CCA and add _STA
The UART _DSD contains only a clock property, which has a typo ("clock-frenquency") and the key/value order is reversed. The declared 100 MHz also does not match the current QEMU model.
The Linux PNP serial driver uses uartclk = 1843200 Hz by default, and the QEMU UART uses baudbase = 115200. These correspond as uartclk / 16 = baudbase (1843200 / 16 = 115200), so the Linux default clock is consistent with the QEMU model. Since the clock property is the only content of the _DSD, remove the entire _DSD rather than keeping an empty one. The QEMU x86 ISA serial ACPI description also does not provide a clock property, which is consistent with this change.
Also drop _CCA because the emulated UART does not support DMA, and add _STA = 0x0f to indicate the device is present, enable, should be shown and functioning properly.
--- hw/loongarch/virt-acpi-build.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
hw/loongarch/virt-acpi-build.c +1 -11
@@ -314,7 +314,6 @@ static void build_uart_device_aml(Aml *table, int index) {Aml *dev;Aml *crs; -Aml *pkg0, *pkg1, *pkg2;Aml *scope;uint32_t uart_irq;uint64_t base;
@@ -325,7 +324,7 @@ static void build_uart_device_aml(Aml *table, int index) dev =aml_device ("COM%d" , index);aml_append (dev,aml_name_decl ("_HID" ,aml_string ("PNP0501" )));aml_append (dev,aml_name_decl ("_UID" ,aml_int (index))); -aml_append (dev,aml_name_decl ("_CCA" ,aml_int (1 ))); +aml_append (dev,aml_name_decl ("_STA" ,aml_int (0x0f ))); crs =aml_resource_template (); aml_append(crs, aml_qword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED,
@@ -335,15 +334,6 @@ static void build_uart_device_aml(Aml *table, int index)aml_append (crs,aml_interrupt (AML_CONSUMER ,AML_LEVEL ,AML_ACTIVE_HIGH ,AML_SHARED , &uart_irq,1 ));aml_append (dev,aml_name_decl ("_CRS" , crs)); - pkg0 =aml_package (0x2 ); -aml_append (pkg0,aml_int (0x05F5E100 )); -aml_append (pkg0,aml_string ("clock-frenquency" )); - pkg1 =aml_package (0x1 ); -aml_append (pkg1, pkg0); - pkg2 =aml_package (0x2 ); -aml_append (pkg2,aml_touuid ("DAFFD814-6EBA-4D8C-8A91-BC9BBF4AA301" )); -aml_append (pkg2, pkg1); -aml_append (dev,aml_name_decl ("_DSD" , pkg2));aml_append (scope, dev);aml_append (table, scope); }
Signature · 1 line
2.56.0
PATCH v3 3/3 tests/data/acpi/loongarch64: Update expected DSDT.*
In reply to pillow --- tests/data/acpi/loongarch64/virt/DSDT (before)
+++ tests/data/acpi/loongarch64/virt/DSDT (after)
@@ -6,7 +6,7 @@
{
Name (_HID, "PNP0501" /* 16550A-compatible COM Serial Port */) // _HID: Hardware ID Name (_UID, Zero) // _UID: Unique ID
- Name (_CCA, One) // _CCA: Cache Coherency Attribute
+ Name (_STA, 0x0F) // _STA: Status
Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
{
QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,
@@ -21,18 +21,6 @@
0x00000042,
}
})
- Name (_DSD, Package (0x02) // _DSD: Device-Specific Data
- {
- ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301") /* Device Properties for _DSD */,
- Package (0x01)
- {
- Package (0x02)
- {
- 0x05F5E100,
- "clock-frenquency"
- }
- }
- })
}
}
@@ -42,7 +30,7 @@
{
Name (_HID, "PNP0501" /* 16550A-compatible COM Serial Port */) // _HID: Hardware ID Name (_UID, One) // _UID: Unique ID
- Name (_CCA, One) // _CCA: Cache Coherency Attribute
+ Name (_STA, 0x0F) // _STA: Status
Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
{
QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,
@@ -57,18 +45,6 @@
0x00000043,
}
})
- Name (_DSD, Package (0x02) // _DSD: Device-Specific Data
- {
- ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301") /* Device Properties for _DSD */,
- Package (0x01)
- {
- Package (0x02)
- {
- 0x05F5E100,
- "clock-frenquency"
- }
- }
- })
}
}
@@ -78,7 +54,7 @@
{
Name (_HID, "PNP0501" /* 16550A-compatible COM Serial Port */) // _HID: Hardware ID Name (_UID, 0x02) // _UID: Unique ID
- Name (_CCA, One) // _CCA: Cache Coherency Attribute
+ Name (_STA, 0x0F) // _STA: Status
Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
{
QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,
@@ -93,18 +69,6 @@
0x00000044,
}
})
- Name (_DSD, Package (0x02) // _DSD: Device-Specific Data
- {
- ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301") /* Device Properties for _DSD */,
- Package (0x01)
- {
- Package (0x02)
- {
- 0x05F5E100,
- "clock-frenquency"
- }
- }
- })
}
}
@@ -114,7 +78,7 @@
{
Name (_HID, "PNP0501" /* 16550A-compatible COM Serial Port */) // _HID: Hardware ID Name (_UID, 0x03) // _UID: Unique ID
- Name (_CCA, One) // _CCA: Cache Coherency Attribute
+ Name (_STA, 0x0F) // _STA: Status
Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
{
QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,
@@ -127,18 +91,6 @@
Interrupt (ResourceConsumer, Level, ActiveHigh, Shared, ,, )
{
0x00000045,
- }
- })
- Name (_DSD, Package (0x02) // _DSD: Device-Specific Data
- {
- ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301") /* Device Properties for _DSD */,
- Package (0x01)
- {
- Package (0x02)
- {
- 0x05F5E100,
- "clock-frenquency"
- }
}
})
}
--- tests/data/acpi/loongarch64/virt/DSDT | Bin 4603 -> 4379 bytes tests/data/acpi/loongarch64/virt/DSDT.memhp | Bin 5824 -> 5600 bytes tests/data/acpi/loongarch64/virt/DSDT.numamem | Bin 4609 -> 4385 bytes .../data/acpi/loongarch64/virt/DSDT.topology | Bin 4905 -> 4681 bytes tests/qtest/bios-tables-test-allowed-diff.h | 4 ---- 5 files changed, 4 deletions(-)
tests/data/acpi/loongarch64/virt/DSDT binary +0 -0
tests/data/acpi/loongarch64/virt/DSDT.memhp binary +0 -0
tests/data/acpi/loongarch64/virt/DSDT.numamem binary +0 -0
tests/data/acpi/loongarch64/virt/DSDT.topology binary +0 -0
tests/qtest/bios-tables-test-allowed-diff.h +0 -4
@@ -1,5 +1 @@/* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/loongarch64/virt/DSDT" , -"tests/data/acpi/loongarch64/virt/DSDT.memhp" , -"tests/data/acpi/loongarch64/virt/DSDT.numamem" , -"tests/data/acpi/loongarch64/virt/DSDT.topology",
Signature · 1 line
2.56.0
PATCH v3 1/3 bios-tables-test-allowed-diff.h: Allow LoongArch DSDT.*
In reply to pillow--- tests/qtest/bios-tables-test-allowed-diff.h | 4 ++++ 1 file changed, 4 insertions(+)
tests/qtest/bios-tables-test-allowed-diff.h +4 -0
@@ -1 +1,5 @@/* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/loongarch64/virt/DSDT" , +"tests/data/acpi/loongarch64/virt/DSDT.memhp" , +"tests/data/acpi/loongarch64/virt/DSDT.numamem" , +"tests/data/acpi/loongarch64/virt/DSDT.topology",
Signature · 1 line
2.56.0
Re: [PATCH v3 2/3] hw/loongarch/virt: Drop UART _DSD/_CCA and add _STA
In reply to pillowQuoted 7 lines · pillow
The UART
_DSDcontains only a clock property, which has a typo ("clock-frenquency") and the key/value order is reversed. The declared 100 MHz also does not match the current QEMU model.The Linux PNP serial driver uses uartclk = 1843200 Hz by default, and the QEMU UART uses baudbase = 115200. These correspond as uartclk / 16 = baudbase (1843200 / 16 = 115200), so the Linux default
baudrate = uartclk / 16 / divider, the default divider is 12, so the default baudrate is 9600. It can be referenced in function serial_reset():
/* Default to 9600 baud, 1 start bit, 8 data bits */
s->divider = 0x0C;The clock freq in FDT table should be changed with 1843200 rather than 100000000, however it may be another issue.
Quoted 52 lines
clock is consistent with the QEMU model. Since the clock property is the only content of the
_DSD, remove the entire_DSDrather than keeping an empty one. The QEMU x86 ISA serial ACPI description also does not provide a clock property, which is consistent with this change.Also drop
_CCAbecause the emulated UART does not support DMA, and add_STA=0x0fto indicate the device is present, enable, should be shown and functioning properly.Signed-off-by pillow <[email protected]>--- hw/loongarch/virt-acpi-build.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)hw/loongarch/virt-acpi-build.c +1
-11@@ -314,7 +314,6 @@ static void build_uart_device_aml(Aml *table, int index) {Aml *dev;Aml *crs; -Aml *pkg0, *pkg1, *pkg2;Aml *scope;uint32_t uart_irq;uint64_t base;@@ -325,7 +324,7 @@ static void build_uart_device_aml(Aml *table, int index) dev =aml_device ("COM%d" , index);aml_append (dev,aml_name_decl ("_HID" ,aml_string ("PNP0501" )));aml_append (dev,aml_name_decl ("_UID" ,aml_int (index))); -aml_append (dev,aml_name_decl ("_CCA" ,aml_int (1 ))); +aml_append (dev,aml_name_decl ("_STA" ,aml_int (0x0f ))); crs =aml_resource_template (); aml_append(crs, aml_qword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED,@@ -335,15 +334,6 @@ static void build_uart_device_aml(Aml *table, int index)aml_append (crs,aml_interrupt (AML_CONSUMER ,AML_LEVEL ,AML_ACTIVE_HIGH ,AML_SHARED , &uart_irq,1 ));aml_append (dev,aml_name_decl ("_CRS" , crs)); - pkg0 =aml_package (0x2 ); -aml_append (pkg0,aml_int (0x05F5E100 )); -aml_append (pkg0,aml_string ("clock-frenquency" )); - pkg1 =aml_package (0x1 ); -aml_append (pkg1, pkg0); - pkg2 =aml_package (0x2 ); -aml_append (pkg2,aml_touuid ("DAFFD814-6EBA-4D8C-8A91-BC9BBF4AA301" )); -aml_append (pkg2, pkg1); - aml_append(dev, aml_name_decl("_DSD", pkg2)); > aml_append(scope, dev);aml_append (table, scope); }
Re: [PATCH v3 2/3] hw/loongarch/virt: Drop UART _DSD/_CCA and add _STA
Hi, all
Agreed. The reset baud rate is 9600, while 115200 is the baudbase.
I've sent v4 with a separate patch correcting the FDT UART clock to 1843200 Hz. I've alse carried your Reviewed-by on the ACPI patch.
Thanks,
pillow
Quoted 81 lines · Bibo Mao
Quoted 7 lines · pillow
The UART
_DSDcontains only a clock property, which has a typo ("clock-frenquency") and the key/value order is reversed. The declared 100 MHz also does not match the current QEMU model.The Linux PNP serial driver uses uartclk = 1843200 Hz by default, and the QEMU UART uses baudbase = 115200. These correspond as uartclk / 16 = baudbase (1843200 / 16 = 115200), so the Linux default
baudrate = uartclk / 16 / divider, the default divider is 12, so the default baudrate is 9600. It can be referenced in function
serial_reset():/* Default to 9600 baud, 1 start bit, 8 data bits */ s->divider = 0x0C;The clock freq in FDT table should be changed with 1843200 rather than 100000000, however it may be another issue.
Reviewed-by Bibo Mao <[email protected]>Quoted 10 lines
clock is consistent with the QEMU model. Since the clock property is the only content of the
_DSD, remove the entire_DSDrather than keeping an empty one. The QEMU x86 ISA serial ACPI description also does not provide a clock property, which is consistent with this change.Also drop
_CCAbecause the emulated UART does not support DMA, and add_STA=0x0fto indicate the device is present, enable, should be shown and functioning properly.Review
Quoted 6 lines
Signed-off-by pillow <[email protected]>--- hw/loongarch/virt-acpi-build.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)(quoted diff) +0
-0
b/hw/loongarch/virt-acpi-build.chw/loongarch/virt-acpi-build.c static void build_uart_device_aml(Aml *table, int
Quoted 4 lines
index 54965f0..55c7641 100644
hw/loongarch/virt-acpi-build.c +0
-0@@ -314,7 +314,6 @@ static void build_uart_device_aml(Aml *table, intindex)
hw/loongarch/virt-acpi-build.c static void build_uart_device_aml(Aml *table, int
Quoted 8 lines
hw/loongarch/virt-acpi-build.c +0
-1{Aml *dev;Aml *crs; -Aml *pkg0, *pkg1, *pkg2;Aml *scope;uint32_t uart_irq;uint64_t base;@@ -325,7 +324,7 @@ static void build_uart_device_aml(Aml *table, intindex)
hw/loongarch/virt-acpi-build.c static void build_uart_device_aml(Aml *table, int
Quoted 9 lines
hw/loongarch/virt-acpi-build.c +1
-1dev =aml_device ("COM%d" , index);aml_append (dev,aml_name_decl ("_HID" ,aml_string ("PNP0501" )));aml_append (dev,aml_name_decl ("_UID" ,aml_int (index))); -aml_append (dev,aml_name_decl ("_CCA" ,aml_int (1 ))); +aml_append (dev,aml_name_decl ("_STA" ,aml_int (0x0f ))); crs =aml_resource_template (); aml_append(crs, aml_qword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED,@@ -335,15 +334,6 @@ static void build_uart_device_aml(Aml *table, intindex)
hw/loongarch/virt-acpi-build.c static void build_uart_device_aml(Aml *table, int · line 334
Quoted 1 line
hw/loongarch/virt-acpi-build.c +0
-0aml_append(crs, aml_interrupt(AML_CONSUMER, AML_LEVEL,
AML_ACTIVE_HIGH,hw/loongarch/virt-acpi-build.c static void build_uart_device_aml(Aml *table, int index)
Quoted 9 lines
hw/loongarch/virt-acpi-build.c +0
-7AML_SHARED, &uart_irq, 1));aml_append (dev,aml_name_decl ("_CRS" , crs)); - pkg0 =aml_package (0x2 ); -aml_append (pkg0,aml_int (0x05F5E100 )); -aml_append (pkg0,aml_string ("clock-frenquency" )); - pkg1 =aml_package (0x1 ); -aml_append (pkg1, pkg0); - pkg2 =aml_package (0x2 ); - aml_append(pkg2,
aml_touuid("DAFFD814-6EBA-4D8C-8A91-BC9BBF4AA301"));hw/loongarch/virt-acpi-build.c static void build_uart_device_aml(Aml *table, int · line 346
Quoted 2 lines
hw/loongarch/virt-acpi-build.c +0
-2-aml_append (pkg2, pkg1); - aml_append(dev, aml_name_decl("_DSD", pkg2)); >
aml_append(scope, dev);Quoted 3 lines
hw/loongarch/virt-acpi-build.c +0
-0aml_append (table, scope); }