Skip to content

Commit c54e52f

Browse files
James Morsectmarinas
authored andcommitted
arm64, irqchip/gic-v3, ACPI: Move MADT GICC enabled check into a helper
ACPI, irqchip and the architecture code all inspect the MADT enabled bit for a GICC entry in the MADT. The addition of an 'online capable' bit means all these sites need updating. Move the current checks behind a helper to make future updates easier. Signed-off-by: James Morse <[email protected]> Reviewed-by: Jonathan Cameron <[email protected]> Reviewed-by: Gavin Shan <[email protected]> Signed-off-by: "Russell King (Oracle)" <[email protected]> Acked-by: "Rafael J. Wysocki" <[email protected]> Reviewed-by: Sudeep Holla <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 851354c commit c54e52f

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

arch/arm64/kernel/smp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)
520520
{
521521
u64 hwid = processor->arm_mpidr;
522522

523-
if (!(processor->flags & ACPI_MADT_ENABLED)) {
523+
if (!acpi_gicc_is_usable(processor)) {
524524
pr_debug("skipping disabled CPU entry with 0x%llx MPIDR\n", hwid);
525525
return;
526526
}

drivers/acpi/processor_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static int map_gicc_mpidr(struct acpi_subtable_header *entry,
9090
struct acpi_madt_generic_interrupt *gicc =
9191
container_of(entry, struct acpi_madt_generic_interrupt, header);
9292

93-
if (!(gicc->flags & ACPI_MADT_ENABLED))
93+
if (!acpi_gicc_is_usable(gicc))
9494
return -ENODEV;
9595

9696
/* device_declaration means Device object in DSDT, in the

drivers/irqchip/irq-gic-v3.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2367,8 +2367,7 @@ gic_acpi_parse_madt_gicc(union acpi_subtable_headers *header,
23672367
u32 size = reg == GIC_PIDR2_ARCH_GICv4 ? SZ_64K * 4 : SZ_64K * 2;
23682368
void __iomem *redist_base;
23692369

2370-
/* GICC entry which has !ACPI_MADT_ENABLED is not unusable so skip */
2371-
if (!(gicc->flags & ACPI_MADT_ENABLED))
2370+
if (!acpi_gicc_is_usable(gicc))
23722371
return 0;
23732372

23742373
redist_base = ioremap(gicc->gicr_base_address, size);
@@ -2418,7 +2417,7 @@ static int __init gic_acpi_match_gicc(union acpi_subtable_headers *header,
24182417
* If GICC is enabled and has valid gicr base address, then it means
24192418
* GICR base is presented via GICC
24202419
*/
2421-
if ((gicc->flags & ACPI_MADT_ENABLED) && gicc->gicr_base_address) {
2420+
if (acpi_gicc_is_usable(gicc) && gicc->gicr_base_address) {
24222421
acpi_data.enabled_rdists++;
24232422
return 0;
24242423
}
@@ -2427,7 +2426,7 @@ static int __init gic_acpi_match_gicc(union acpi_subtable_headers *header,
24272426
* It's perfectly valid firmware can pass disabled GICC entry, driver
24282427
* should not treat as errors, skip the entry instead of probe fail.
24292428
*/
2430-
if (!(gicc->flags & ACPI_MADT_ENABLED))
2429+
if (!acpi_gicc_is_usable(gicc))
24312430
return 0;
24322431

24332432
return -ENODEV;
@@ -2486,8 +2485,7 @@ static int __init gic_acpi_parse_virt_madt_gicc(union acpi_subtable_headers *hea
24862485
int maint_irq_mode;
24872486
static int first_madt = true;
24882487

2489-
/* Skip unusable CPUs */
2490-
if (!(gicc->flags & ACPI_MADT_ENABLED))
2488+
if (!acpi_gicc_is_usable(gicc))
24912489
return 0;
24922490

24932491
maint_irq_mode = (gicc->flags & ACPI_MADT_VGIC_IRQ_MODE) ?

include/linux/acpi.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,11 @@ acpi_table_parse_cedt(enum acpi_cedt_type id,
256256
int acpi_parse_mcfg (struct acpi_table_header *header);
257257
void acpi_table_print_madt_entry (struct acpi_subtable_header *madt);
258258

259+
static inline bool acpi_gicc_is_usable(struct acpi_madt_generic_interrupt *gicc)
260+
{
261+
return gicc->flags & ACPI_MADT_ENABLED;
262+
}
263+
259264
/* the following numa functions are architecture-dependent */
260265
void acpi_numa_slit_init (struct acpi_table_slit *slit);
261266

0 commit comments

Comments
 (0)