Skip to content

Commit e0013ae

Browse files
mrutland-armwildea01
authored andcommitted
arm64: add function to get a cpu's MADT GICC table
Currently the ACPI parking protocol code needs to parse each CPU's MADT GICC table to extract the mailbox address and so on. Each time we parse a GICC table, we call back to the parking protocol code to parse it. This has been fine so far, but we're about to have more code that needs to extract data from the GICC tables, and adding a callback for each user is going to get unwieldy. Instead, this patch ensures that we stash a copy of each CPU's GICC table at boot time, such that anything needing to parse it can later request it. This will allow for other parsers of GICC, and for simplification to the ACPI parking protocol code. Note that we must store a copy, rather than a pointer, since the core ACPI code temporarily maps/unmaps tables while iterating over them. Since we parse the MADT before we know how many CPUs we have (and hence before we setup the percpu areas), we must use an NR_CPUS sized array. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Reviewed-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Tested-by: Jeremy Linton <jeremy.linton@arm.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will.deacon@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
1 parent 18bfcfe commit e0013ae

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

‎arch/arm64/include/asm/acpi.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ static inline bool acpi_has_cpu_in_madt(void)
8585
return true;
8686
}
8787

88+
struct acpi_madt_generic_interrupt *acpi_cpu_get_madt_gicc(int cpu);
89+
8890
static inline void arch_fix_phys_package_id(int num, u32 slot) { }
8991
void __init acpi_init_cpus(void);
9092

‎arch/arm64/kernel/smp.c‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,13 @@ static bool bootcpu_valid __initdata;
518518
static unsigned int cpu_count = 1;
519519

520520
#ifdef CONFIG_ACPI
521+
static struct acpi_madt_generic_interrupt cpu_madt_gicc[NR_CPUS];
522+
523+
struct acpi_madt_generic_interrupt *acpi_cpu_get_madt_gicc(int cpu)
524+
{
525+
return &cpu_madt_gicc[cpu];
526+
}
527+
521528
/*
522529
* acpi_map_gic_cpu_interface - parse processor MADT entry
523530
*
@@ -552,6 +559,7 @@ acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)
552559
return;
553560
}
554561
bootcpu_valid = true;
562+
cpu_madt_gicc[0] = *processor;
555563
early_map_cpu_to_node(0, acpi_numa_get_nid(0, hwid));
556564
return;
557565
}
@@ -562,6 +570,8 @@ acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)
562570
/* map the logical cpu id to cpu MPIDR */
563571
cpu_logical_map(cpu_count) = hwid;
564572

573+
cpu_madt_gicc[cpu_count] = *processor;
574+
565575
/*
566576
* Set-up the ACPI parking protocol cpu entries
567577
* while initializing the cpu_logical_map to

0 commit comments

Comments
 (0)