Skip to content

Commit 2abc2bd

Browse files
HarithGeorge-AlifSemigregkh
authored andcommitted
ARM: 9420/1: smp: Fix SMP for xip kernels
[ Upstream commit 9e9b0cf ] Fix the physical address calculation of the following to get smp working on xip kernels. - secondary_data needed for secondary cpu bootup. - secondary_startup address passed through psci. - identity mapped code region needed for enabling mmu for secondary cpus. Signed-off-by: Harith George <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Signed-off-by: Russell King (Oracle) <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 344fb3c commit 2abc2bd

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

arch/arm/kernel/head.S

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,11 @@ ENTRY(secondary_startup)
411411
/*
412412
* Use the page tables supplied from __cpu_up.
413413
*/
414+
#ifdef CONFIG_XIP_KERNEL
415+
ldr r3, =(secondary_data + PLAT_PHYS_OFFSET - PAGE_OFFSET)
416+
#else
414417
adr_l r3, secondary_data
418+
#endif
415419
mov_l r12, __secondary_switched
416420
ldrd r4, r5, [r3, #0] @ get secondary_data.pgdir
417421
ARM_BE8(eor r4, r4, r5) @ Swap r5 and r4 in BE:

arch/arm/kernel/psci_smp.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,15 @@ extern void secondary_startup(void);
4545
static int psci_boot_secondary(unsigned int cpu, struct task_struct *idle)
4646
{
4747
if (psci_ops.cpu_on)
48+
#ifdef CONFIG_XIP_KERNEL
49+
return psci_ops.cpu_on(cpu_logical_map(cpu),
50+
((phys_addr_t)(&secondary_startup)
51+
- XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR)
52+
+ CONFIG_XIP_PHYS_ADDR));
53+
#else
4854
return psci_ops.cpu_on(cpu_logical_map(cpu),
4955
virt_to_idmap(&secondary_startup));
56+
#endif
5057
return -ENODEV;
5158
}
5259

arch/arm/mm/idmap.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,15 @@ static void identity_mapping_add(pgd_t *pgd, const char *text_start,
8484
unsigned long addr, end;
8585
unsigned long next;
8686

87+
#ifdef CONFIG_XIP_KERNEL
88+
addr = (phys_addr_t)(text_start) - XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR)
89+
+ CONFIG_XIP_PHYS_ADDR;
90+
end = (phys_addr_t)(text_end) - XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR)
91+
+ CONFIG_XIP_PHYS_ADDR;
92+
#else
8793
addr = virt_to_idmap(text_start);
8894
end = virt_to_idmap(text_end);
95+
#endif
8996
pr_info("Setting up static identity map for 0x%lx - 0x%lx\n", addr, end);
9097

9198
prot |= PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_SECT_AF;

0 commit comments

Comments
 (0)