hw/loogarch: Fix UART ACPI properties and FDT
v5 cover hw/loogarch: Fix UART ACPI properties and FDT
This series fixes the UART description for LoongArch virt.
The ACPI _DSD property built for the UART has three problems: the property name is misspelled, the key and value order is reversed, and it describes a 100 MHz clock that does not match the device model. The property can be dropped directly because the UART model's input clock matches the Linux 8250 PnP driver default of 1,843,200 Hz, so no _DSD override is needed.
The _CCA property is also unnecessary. _CCA describes a device's DMA cache coherency attribute, and this UART does not support DMA, so there is no reason to declare it.
The UART clock frequency in the FDT is corrected to 1,843,200 Hz, and the expected ACPI tables are updated accordingly.
pillow (5):
bios-tables-test-allowed-diff.h: Allow LoongArch DSDT.* hw/loongarch/virt-acpi-build: Drop invalid _DSD UART clock property hw/loongarch/virt-acpi-build: Drop UART _CCA declaration hw/loongarch/virt: Fix UART clock frequency in FDT tests/data/acpi/loongarch64: Update expected DSDT.*
hw/loongarch/virt-acpi-build.c | 11 ----------- hw/loongarch/virt-fdt-build.c | 2 +- tests/data/acpi/loongarch64/virt/DSDT | Bin 4603 -> 4351 bytes tests/data/acpi/loongarch64/virt/DSDT.memhp | Bin 5824 -> 5572 bytes tests/data/acpi/loongarch64/virt/DSDT.numamem | Bin 4609 -> 4357 bytes .../data/acpi/loongarch64/virt/DSDT.topology | Bin 4905 -> 4653 bytes 6 files changed, 1 insertion(+), 12 deletions(-)
Signature · 1 line
2.56.0
PATCH v5 2/5 hw/loongarch/virt-acpi-build: Drop invalid _DSD UART clock property
Delete the code that constructs the _DSD property and its dedicated variables. The original property had three problems: its name was misspelled, the key and value order was reversed, and it described a 100 MHz clock, which does not match the device model.
The property can be removed directly because the UART model's input clock matches the Linux 8250 PnP driver default of 1,843,200 Hz, so no _DSD override is needed.
--- hw/loongarch/virt-acpi-build.c | 10 ---------- 1 file changed, 10 deletions(-)
hw/loongarch/virt-acpi-build.c +0 -10
@@ -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;
@@ -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 v5 1/5 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
PATCH v5 3/5 hw/loongarch/virt-acpi-build: Drop UART _CCA declaration
In reply to pillowRemove the _CCA property from the UART device. _CCA describes a device's DMA cache coherency attributes. This UART does not support DMA, so there is no need to declare this property.
--- hw/loongarch/virt-acpi-build.c | 1 - 1 file changed, 1 deletion(-)
hw/loongarch/virt-acpi-build.c +0 -1
@@ -324,7 +324,6 @@ 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 ))); crs =aml_resource_template (); aml_append(crs, aml_qword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED,
Signature · 1 line
2.56.0
PATCH v5 4/5 hw/loongarch/virt: Fix UART clock frequency in FDT
In reply to pillowThe UART uses baudbase = 115200, corresponding to an input clock of 1843200 Hz. Update the FDT clock-frequency property to match the model.
--- hw/loongarch/virt-fdt-build.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/loongarch/virt-fdt-build.c +1 -1
@@ -474,7 +474,7 @@ static void fdt_add_uart_node(LoongArchVirtMachineState *lvms,qemu_fdt_add_subnode (ms->fdt, nodename);qemu_fdt_setprop_string (ms->fdt, nodename,"compatible" ,"ns16550a" );qemu_fdt_setprop_cells (ms->fdt, nodename,"reg" ,0x0 , base,0x0 , size); -qemu_fdt_setprop_cell (ms->fdt, nodename,"clock-frequency" ,100000000 ); +qemu_fdt_setprop_cell (ms->fdt, nodename,"clock-frequency" ,1843200 );if (chosen) {qemu_fdt_setprop_string (ms->fdt,"/chosen" ,"stdout-path" , nodename); }
Signature · 1 line
2.56.0
PATCH v5 5/5 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,6 @@
{
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 (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
{
QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,
@@ -21,18 +20,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 +29,6 @@
{
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 (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
{
QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,
@@ -57,18 +43,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 +52,6 @@
{
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 (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
{
QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,
@@ -93,18 +66,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 +75,6 @@
{
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 (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
{
QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,
@@ -127,18 +87,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 -> 4351 bytes tests/data/acpi/loongarch64/virt/DSDT.memhp | Bin 5824 -> 5572 bytes tests/data/acpi/loongarch64/virt/DSDT.numamem | Bin 4609 -> 4357 bytes .../data/acpi/loongarch64/virt/DSDT.topology | Bin 4905 -> 4653 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
Quoted 23 lines · pillow
This series fixes the UART description for LoongArch virt.
The ACPI
_DSDproperty built for the UART has three problems: the property name is misspelled, the key and value order is reversed, and it describes a 100 MHz clock that does not match the device model. The property can be dropped directly because the UART model's input clock matches the Linux 8250 PnP driver default of 1,843,200 Hz, so no_DSDoverride is needed.The
_CCAproperty is also unnecessary._CCAdescribes a device's DMA cache coherency attribute, and this UART does not support DMA, so there is no reason to declare it.The UART clock frequency in the FDT is corrected to 1,843,200 Hz, and the expected ACPI tables are updated accordingly.
pillow (5):
bios-tables-test-allowed-diff.h: Allow LoongArch DSDT.* hw/loongarch/virt-acpi-build: Drop invalid_DSDUART clock property hw/loongarch/virt-acpi-build: Drop UART_CCAdeclaration hw/loongarch/virt: Fix UART clock frequency in FDT tests/data/acpi/loongarch64: Update expected DSDT.*
Quoted 8 lines
hw/loongarch/virt-acpi-build.c | 11 ----------- hw/loongarch/virt-fdt-build.c | 2 +- tests/data/acpi/loongarch64/virt/DSDT | Bin 4603 -> 4351 bytes tests/data/acpi/loongarch64/virt/DSDT.memhp | Bin 5824 -> 5572 bytes tests/data/acpi/loongarch64/virt/DSDT.numamem | Bin 4609 -> 4357 bytes .../data/acpi/loongarch64/virt/DSDT.topology | Bin 4905 -> 4653 bytes 6 files changed, 1 insertion(+), 12 deletions(-)
Removing _STA works on some x86 windows and linux guest OSs by testing, with LoongArch it works well on Linux guest OS.
For this series:
Quoted 23 lines · pillow
This series fixes the UART description for LoongArch virt.
The ACPI
_DSDproperty built for the UART has three problems: the property name is misspelled, the key and value order is reversed, and it describes a 100 MHz clock that does not match the device model. The property can be dropped directly because the UART model's input clock matches the Linux 8250 PnP driver default of 1,843,200 Hz, so no_DSDoverride is needed.The
_CCAproperty is also unnecessary._CCAdescribes a device's DMA cache coherency attribute, and this UART does not support DMA, so there is no reason to declare it.The UART clock frequency in the FDT is corrected to 1,843,200 Hz, and the expected ACPI tables are updated accordingly.
pillow (5):
bios-tables-test-allowed-diff.h: Allow LoongArch DSDT.* hw/loongarch/virt-acpi-build: Drop invalid_DSDUART clock property hw/loongarch/virt-acpi-build: Drop UART_CCAdeclaration hw/loongarch/virt: Fix UART clock frequency in FDT tests/data/acpi/loongarch64: Update expected DSDT.*
Quoted 8 lines
hw/loongarch/virt-acpi-build.c | 11 ----------- hw/loongarch/virt-fdt-build.c | 2 +- tests/data/acpi/loongarch64/virt/DSDT | Bin 4603 -> 4351 bytes tests/data/acpi/loongarch64/virt/DSDT.memhp | Bin 5824 -> 5572 bytes tests/data/acpi/loongarch64/virt/DSDT.numamem | Bin 4609 -> 4357 bytes .../data/acpi/loongarch64/virt/DSDT.topology | Bin 4905 -> 4653 bytes 6 files changed, 1 insertion(+), 12 deletions(-)
Hi!
Should this change be picked up fr current qemu stable releases?
Thanks,
/mjt
Quoted 33 lines · Michael Tokarev
Quoted 23 lines · pillow
This series fixes the UART description for LoongArch virt.
The ACPI
_DSDproperty built for the UART has three problems: the property name is misspelled, the key and value order is reversed, and it describes a 100 MHz clock that does not match the device model. The property can be dropped directly because the UART model's input clock matches the Linux 8250 PnP driver default of 1,843,200 Hz, so no_DSDoverride is needed.The
_CCAproperty is also unnecessary._CCAdescribes a device's DMA cache coherency attribute, and this UART does not support DMA, so there is no reason to declare it.The UART clock frequency in the FDT is corrected to 1,843,200 Hz, and the expected ACPI tables are updated accordingly.
pillow (5):
bios-tables-test-allowed-diff.h: Allow LoongArch DSDT.* hw/loongarch/virt-acpi-build: Drop invalid_DSDUART clock property hw/loongarch/virt-acpi-build: Drop UART_CCAdeclaration hw/loongarch/virt: Fix UART clock frequency in FDT tests/data/acpi/loongarch64: Update expected DSDT.*Quoted 8 lines
hw/loongarch/virt-acpi-build.c | 11 ----------- hw/loongarch/virt-fdt-build.c | 2 +- tests/data/acpi/loongarch64/virt/DSDT | Bin 4603 -> 4351 bytes tests/data/acpi/loongarch64/virt/DSDT.memhp | Bin 5824 -> 5572 bytes tests/data/acpi/loongarch64/virt/DSDT.numamem | Bin 4609 -> 4357 bytes .../data/acpi/loongarch64/virt/DSDT.topology | Bin 4905 -> 4653 bytes
6 files changed, 1 insertion(+), 12 deletions(-)
Quoted 3 lines
Hi!
Should this change be picked up fr current qemu stable releases?
The _DSD property name of UART is misspelled, OS will use the default clock and continue to execute.
It is a problem however not urgent, so I think it is not necessary to pickup for qemu stable releases.
Regards
Bibo Mao
Quoted 4 lines
Thanks,
/mjt