hw/arm/virt-acpi-build: Don't incorrectly claim architectural timer to be edge-triggered
This is the ACPI equivalent to "hw/arm/virt: Don't incorrectly claim architectural timer to be edge-triggered" which fixes the DT for machine types 2.9 and later. Signed-off-by: Andrew Jones <drjones@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Message-id: 20170102200153.28864-15-drjones@redhat.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
af1f60a402
commit
8dd845d3c4
@ -535,25 +535,33 @@ build_mcfg(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
|
|||||||
|
|
||||||
/* GTDT */
|
/* GTDT */
|
||||||
static void
|
static void
|
||||||
build_gtdt(GArray *table_data, BIOSLinker *linker)
|
build_gtdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
|
||||||
{
|
{
|
||||||
|
VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms);
|
||||||
int gtdt_start = table_data->len;
|
int gtdt_start = table_data->len;
|
||||||
AcpiGenericTimerTable *gtdt;
|
AcpiGenericTimerTable *gtdt;
|
||||||
|
uint32_t irqflags;
|
||||||
|
|
||||||
|
if (vmc->claim_edge_triggered_timers) {
|
||||||
|
irqflags = ACPI_GTDT_INTERRUPT_MODE_EDGE;
|
||||||
|
} else {
|
||||||
|
irqflags = ACPI_GTDT_INTERRUPT_MODE_LEVEL;
|
||||||
|
}
|
||||||
|
|
||||||
gtdt = acpi_data_push(table_data, sizeof *gtdt);
|
gtdt = acpi_data_push(table_data, sizeof *gtdt);
|
||||||
/* The interrupt values are the same with the device tree when adding 16 */
|
/* The interrupt values are the same with the device tree when adding 16 */
|
||||||
gtdt->secure_el1_interrupt = cpu_to_le32(ARCH_TIMER_S_EL1_IRQ + 16);
|
gtdt->secure_el1_interrupt = cpu_to_le32(ARCH_TIMER_S_EL1_IRQ + 16);
|
||||||
gtdt->secure_el1_flags = cpu_to_le32(ACPI_GTDT_INTERRUPT_MODE_EDGE);
|
gtdt->secure_el1_flags = cpu_to_le32(irqflags);
|
||||||
|
|
||||||
gtdt->non_secure_el1_interrupt = cpu_to_le32(ARCH_TIMER_NS_EL1_IRQ + 16);
|
gtdt->non_secure_el1_interrupt = cpu_to_le32(ARCH_TIMER_NS_EL1_IRQ + 16);
|
||||||
gtdt->non_secure_el1_flags = cpu_to_le32(ACPI_GTDT_INTERRUPT_MODE_EDGE |
|
gtdt->non_secure_el1_flags = cpu_to_le32(irqflags |
|
||||||
ACPI_GTDT_CAP_ALWAYS_ON);
|
ACPI_GTDT_CAP_ALWAYS_ON);
|
||||||
|
|
||||||
gtdt->virtual_timer_interrupt = cpu_to_le32(ARCH_TIMER_VIRT_IRQ + 16);
|
gtdt->virtual_timer_interrupt = cpu_to_le32(ARCH_TIMER_VIRT_IRQ + 16);
|
||||||
gtdt->virtual_timer_flags = cpu_to_le32(ACPI_GTDT_INTERRUPT_MODE_EDGE);
|
gtdt->virtual_timer_flags = cpu_to_le32(irqflags);
|
||||||
|
|
||||||
gtdt->non_secure_el2_interrupt = cpu_to_le32(ARCH_TIMER_NS_EL2_IRQ + 16);
|
gtdt->non_secure_el2_interrupt = cpu_to_le32(ARCH_TIMER_NS_EL2_IRQ + 16);
|
||||||
gtdt->non_secure_el2_flags = cpu_to_le32(ACPI_GTDT_INTERRUPT_MODE_EDGE);
|
gtdt->non_secure_el2_flags = cpu_to_le32(irqflags);
|
||||||
|
|
||||||
build_header(linker, table_data,
|
build_header(linker, table_data,
|
||||||
(void *)(table_data->data + gtdt_start), "GTDT",
|
(void *)(table_data->data + gtdt_start), "GTDT",
|
||||||
@ -736,7 +744,7 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables)
|
|||||||
build_madt(tables_blob, tables->linker, vms);
|
build_madt(tables_blob, tables->linker, vms);
|
||||||
|
|
||||||
acpi_add_table(table_offsets, tables_blob);
|
acpi_add_table(table_offsets, tables_blob);
|
||||||
build_gtdt(tables_blob, tables->linker);
|
build_gtdt(tables_blob, tables->linker, vms);
|
||||||
|
|
||||||
acpi_add_table(table_offsets, tables_blob);
|
acpi_add_table(table_offsets, tables_blob);
|
||||||
build_mcfg(tables_blob, tables->linker, vms);
|
build_mcfg(tables_blob, tables->linker, vms);
|
||||||
|
@ -428,6 +428,7 @@ typedef struct AcpiMadtGenericTranslator AcpiMadtGenericTranslator;
|
|||||||
/*
|
/*
|
||||||
* Generic Timer Description Table (GTDT)
|
* Generic Timer Description Table (GTDT)
|
||||||
*/
|
*/
|
||||||
|
#define ACPI_GTDT_INTERRUPT_MODE_LEVEL (0 << 0)
|
||||||
#define ACPI_GTDT_INTERRUPT_MODE_EDGE (1 << 0)
|
#define ACPI_GTDT_INTERRUPT_MODE_EDGE (1 << 0)
|
||||||
#define ACPI_GTDT_CAP_ALWAYS_ON (1 << 2)
|
#define ACPI_GTDT_CAP_ALWAYS_ON (1 << 2)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user