Skip to content

Commit a845342

Browse files
asdfugilKAGA-KOKO
authored andcommitted
irqchip/apple-aic: Add a new "Global fast IPIs only" feature level
Starting with the A11 (T8015) SoC, Apple began using arm64 sysregs for fast IPIs. However, on A11, there is no such things as "Local" fast IPIs, as the SYS_IMP_APL_IPI_RR_LOCAL_EL1 register does not seem to exist. Add a new feature level, used by the compatible "apple,t8015-aic", controlled by a static branch key named use_local_fast_ipi. When use_fast_ipi is true and use_local_fast_ipi is false, fast IPIs are used but all IPIs goes through the register SYS_IMP_APL_IPI_RR_GLOBAL_EL1, as "global" IPIs. Signed-off-by: Nick Chan <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Sven Peter <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent 5527b06 commit a845342

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

drivers/irqchip/irq-apple-aic.c

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,8 @@ enum fiq_hwirq {
235235
};
236236

237237
static DEFINE_STATIC_KEY_TRUE(use_fast_ipi);
238+
/* True if SYS_IMP_APL_IPI_RR_LOCAL_EL1 exists for local fast IPIs (M1+) */
239+
static DEFINE_STATIC_KEY_TRUE(use_local_fast_ipi);
238240

239241
struct aic_info {
240242
int version;
@@ -252,6 +254,7 @@ struct aic_info {
252254

253255
/* Features */
254256
bool fast_ipi;
257+
bool local_fast_ipi;
255258
};
256259

257260
static const struct aic_info aic1_info __initconst = {
@@ -270,17 +273,32 @@ static const struct aic_info aic1_fipi_info __initconst = {
270273
.fast_ipi = true,
271274
};
272275

276+
static const struct aic_info aic1_local_fipi_info __initconst = {
277+
.version = 1,
278+
279+
.event = AIC_EVENT,
280+
.target_cpu = AIC_TARGET_CPU,
281+
282+
.fast_ipi = true,
283+
.local_fast_ipi = true,
284+
};
285+
273286
static const struct aic_info aic2_info __initconst = {
274287
.version = 2,
275288

276289
.irq_cfg = AIC2_IRQ_CFG,
277290

278291
.fast_ipi = true,
292+
.local_fast_ipi = true,
279293
};
280294

281295
static const struct of_device_id aic_info_match[] = {
282296
{
283297
.compatible = "apple,t8103-aic",
298+
.data = &aic1_local_fipi_info,
299+
},
300+
{
301+
.compatible = "apple,t8015-aic",
284302
.data = &aic1_fipi_info,
285303
},
286304
{
@@ -750,12 +768,12 @@ static void aic_ipi_send_fast(int cpu)
750768
u64 cluster = MPIDR_CLUSTER(mpidr);
751769
u64 idx = MPIDR_CPU(mpidr);
752770

753-
if (MPIDR_CLUSTER(my_mpidr) == cluster)
754-
write_sysreg_s(FIELD_PREP(IPI_RR_CPU, idx),
755-
SYS_IMP_APL_IPI_RR_LOCAL_EL1);
756-
else
771+
if (static_branch_likely(&use_local_fast_ipi) && MPIDR_CLUSTER(my_mpidr) == cluster) {
772+
write_sysreg_s(FIELD_PREP(IPI_RR_CPU, idx), SYS_IMP_APL_IPI_RR_LOCAL_EL1);
773+
} else {
757774
write_sysreg_s(FIELD_PREP(IPI_RR_CPU, idx) | FIELD_PREP(IPI_RR_CLUSTER, cluster),
758775
SYS_IMP_APL_IPI_RR_GLOBAL_EL1);
776+
}
759777
isb();
760778
}
761779

@@ -990,6 +1008,9 @@ static int __init aic_of_ic_init(struct device_node *node, struct device_node *p
9901008
if (!irqc->info.fast_ipi)
9911009
static_branch_disable(&use_fast_ipi);
9921010

1011+
if (!irqc->info.local_fast_ipi)
1012+
static_branch_disable(&use_local_fast_ipi);
1013+
9931014
irqc->info.die_stride = off - start_off;
9941015

9951016
irqc->hw_domain = irq_domain_create_tree(of_node_to_fwnode(node),

0 commit comments

Comments
 (0)