mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
ACPI: GTDT: Parse information related to the EL2 virtual timer
Now that we have a way to identify GTDTv3, allow the information related to the EL2 virtual timer to be retrieved by the interface used by the architected timer driver. Signed-off-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org> Reviewed-by: Sudeep Holla <sudeep.holla@kernel.org> Reviewed-by: Hanjun Guo <guohanjun@huawei.com> Link: https://patch.msgid.link/20260523140242.586031-3-maz@kernel.org
This commit is contained in:
parent
002dcb3a89
commit
fe15af3e75
|
|
@ -41,6 +41,14 @@ struct gtdt_v3 {
|
|||
|
||||
static struct acpi_gtdt_descriptor acpi_gtdt_desc __initdata;
|
||||
|
||||
static __init struct acpi_gtdt_el2 *gtdt_to_el2_vtimer(struct acpi_table_gtdt *gtdt)
|
||||
{
|
||||
if (gtdt->header.revision < 3)
|
||||
return NULL;
|
||||
|
||||
return &container_of(gtdt, struct gtdt_v3, gtdt_v2)->el2_vtimer;
|
||||
}
|
||||
|
||||
static __init bool platform_timer_valid(void *platform_timer)
|
||||
{
|
||||
struct acpi_gtdt_header *gh = platform_timer;
|
||||
|
|
@ -112,6 +120,7 @@ static int __init map_gt_gsi(u32 interrupt, u32 flags)
|
|||
int __init acpi_gtdt_map_ppi(int type)
|
||||
{
|
||||
struct acpi_table_gtdt *gtdt = acpi_gtdt_desc.gtdt;
|
||||
struct acpi_gtdt_el2 *el2_vtimer = gtdt_to_el2_vtimer(gtdt);
|
||||
|
||||
switch (type) {
|
||||
case ARCH_TIMER_PHYS_NONSECURE_PPI:
|
||||
|
|
@ -124,6 +133,12 @@ int __init acpi_gtdt_map_ppi(int type)
|
|||
case ARCH_TIMER_HYP_PPI:
|
||||
return map_gt_gsi(gtdt->non_secure_el2_interrupt,
|
||||
gtdt->non_secure_el2_flags);
|
||||
case ARCH_TIMER_HYP_VIRT_PPI:
|
||||
if (el2_vtimer && el2_vtimer->virtual_el2_timer_gsiv)
|
||||
return map_gt_gsi(el2_vtimer->virtual_el2_timer_gsiv,
|
||||
el2_vtimer->virtual_el2_timer_flags);
|
||||
|
||||
return 0;
|
||||
default:
|
||||
pr_err("Failed to map timer interrupt: invalid type.\n");
|
||||
}
|
||||
|
|
@ -141,6 +156,7 @@ int __init acpi_gtdt_map_ppi(int type)
|
|||
bool __init acpi_gtdt_c3stop(int type)
|
||||
{
|
||||
struct acpi_table_gtdt *gtdt = acpi_gtdt_desc.gtdt;
|
||||
struct acpi_gtdt_el2 *el2_vtimer = gtdt_to_el2_vtimer(gtdt);
|
||||
|
||||
switch (type) {
|
||||
case ARCH_TIMER_PHYS_NONSECURE_PPI:
|
||||
|
|
@ -152,6 +168,10 @@ bool __init acpi_gtdt_c3stop(int type)
|
|||
case ARCH_TIMER_HYP_PPI:
|
||||
return !(gtdt->non_secure_el2_flags & ACPI_GTDT_ALWAYS_ON);
|
||||
|
||||
case ARCH_TIMER_HYP_VIRT_PPI:
|
||||
return el2_vtimer && el2_vtimer->virtual_el2_timer_gsiv &&
|
||||
!(el2_vtimer->virtual_el2_timer_flags & ACPI_GTDT_ALWAYS_ON);
|
||||
|
||||
default:
|
||||
pr_err("Failed to get c3stop info: invalid type.\n");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user