Message ID | 20190722213958.5761-31-julien.grall@arm.com |
---|---|
State | Superseded |
Headers | show |
Series | xen/arm: Rework head.S to make it more compliant with the Arm Arm | expand |
On Mon, 22 Jul 2019, Julien Grall wrote: > setup_fixmap() will setup the fixmap in the boot page tables in order to > use earlyprintk and also update the register r11 holding the address to > the UART. > > However, secondary CPUs are not using earlyprintk between turning the > MMU on and switching to the runtime page table. So setting up the > fixmap in the boot pages table is pointless. > > This means most of setup_fixmap() is not necessary for the secondary > CPUs. The update of UART address is now moved out of setup_fixmap() and > duplicated in the CPU boot and secondary CPUs boot. Additionally, the > call to setup_fixmap() is removed from secondary CPUs boot. > > Lastly, take the opportunity to replace load from literal pool with the > new macro mov_w. > > Signed-off-by: Julien Grall <julien.grall@arm.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> > --- > Changes in v2: > - Patch added > --- > xen/arch/arm/arm32/head.S | 20 ++++++++------------ > 1 file changed, 8 insertions(+), 12 deletions(-) > > diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S > index 6dc6032498..0a5c3a8525 100644 > --- a/xen/arch/arm/arm32/head.S > +++ b/xen/arch/arm/arm32/head.S > @@ -159,6 +159,10 @@ past_zImage: > mov pc, r0 > primary_switched: > bl setup_fixmap > +#ifdef CONFIG_EARLY_PRINTK > + /* Use a virtual address to access the UART. */ > + mov_w r11, EARLY_UART_VIRTUAL_ADDRESS > +#endif > b launch > ENDPROC(start) > > @@ -200,8 +204,6 @@ GLOBAL(init_secondary) > ldr r0, =secondary_switched > mov pc, r0 > secondary_switched: > - bl setup_fixmap > - > /* > * Non-boot CPUs need to move on to the proper pagetables, which were > * setup in init_secondary_pagetables. > @@ -221,6 +223,10 @@ secondary_switched: > dsb /* Ensure completion of TLB+BP flush */ > isb > > +#ifdef CONFIG_EARLY_PRINTK > + /* Use a virtual address to access the UART. */ > + mov_w r11, EARLY_UART_VIRTUAL_ADDRESS > +#endif > b launch > ENDPROC(init_secondary) > > @@ -475,13 +481,6 @@ setup_fixmap: > */ > dsb > #if defined(CONFIG_EARLY_PRINTK) /* Fixmap is only used by early printk */ > - /* > - * Non-boot CPUs don't need to rebuild the fixmap itself, just > - * the mapping from boot_second to xen_fixmap > - */ > - teq r12, #0 > - bne 1f > - > /* Add UART to the fixmap table */ > ldr r1, =xen_fixmap /* r1 := vaddr (xen_fixmap) */ > lsr r2, r11, #THIRD_SHIFT > @@ -502,9 +501,6 @@ setup_fixmap: > mov r4, r4, lsr #(SECOND_SHIFT - 3) /* r4 := Slot for FIXMAP(0) */ > mov r3, #0x0 > strd r2, r3, [r1, r4] /* Map it in the fixmap's slot */ > - > - /* Use a virtual address to access the UART. */ > - ldr r11, =EARLY_UART_VIRTUAL_ADDRESS > #endif > > /* > -- > 2.11.0 >
diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S index 6dc6032498..0a5c3a8525 100644 --- a/xen/arch/arm/arm32/head.S +++ b/xen/arch/arm/arm32/head.S @@ -159,6 +159,10 @@ past_zImage: mov pc, r0 primary_switched: bl setup_fixmap +#ifdef CONFIG_EARLY_PRINTK + /* Use a virtual address to access the UART. */ + mov_w r11, EARLY_UART_VIRTUAL_ADDRESS +#endif b launch ENDPROC(start) @@ -200,8 +204,6 @@ GLOBAL(init_secondary) ldr r0, =secondary_switched mov pc, r0 secondary_switched: - bl setup_fixmap - /* * Non-boot CPUs need to move on to the proper pagetables, which were * setup in init_secondary_pagetables. @@ -221,6 +223,10 @@ secondary_switched: dsb /* Ensure completion of TLB+BP flush */ isb +#ifdef CONFIG_EARLY_PRINTK + /* Use a virtual address to access the UART. */ + mov_w r11, EARLY_UART_VIRTUAL_ADDRESS +#endif b launch ENDPROC(init_secondary) @@ -475,13 +481,6 @@ setup_fixmap: */ dsb #if defined(CONFIG_EARLY_PRINTK) /* Fixmap is only used by early printk */ - /* - * Non-boot CPUs don't need to rebuild the fixmap itself, just - * the mapping from boot_second to xen_fixmap - */ - teq r12, #0 - bne 1f - /* Add UART to the fixmap table */ ldr r1, =xen_fixmap /* r1 := vaddr (xen_fixmap) */ lsr r2, r11, #THIRD_SHIFT @@ -502,9 +501,6 @@ setup_fixmap: mov r4, r4, lsr #(SECOND_SHIFT - 3) /* r4 := Slot for FIXMAP(0) */ mov r3, #0x0 strd r2, r3, [r1, r4] /* Map it in the fixmap's slot */ - - /* Use a virtual address to access the UART. */ - ldr r11, =EARLY_UART_VIRTUAL_ADDRESS #endif /*
setup_fixmap() will setup the fixmap in the boot page tables in order to use earlyprintk and also update the register r11 holding the address to the UART. However, secondary CPUs are not using earlyprintk between turning the MMU on and switching to the runtime page table. So setting up the fixmap in the boot pages table is pointless. This means most of setup_fixmap() is not necessary for the secondary CPUs. The update of UART address is now moved out of setup_fixmap() and duplicated in the CPU boot and secondary CPUs boot. Additionally, the call to setup_fixmap() is removed from secondary CPUs boot. Lastly, take the opportunity to replace load from literal pool with the new macro mov_w. Signed-off-by: Julien Grall <julien.grall@arm.com> --- Changes in v2: - Patch added --- xen/arch/arm/arm32/head.S | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)