[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 2/7] xen/arm: setup the fixmap in head.S
Setup the fixmap mapping directly in head.S rather than having a temporary mapping only to re-do it later in C. Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> --- xen/arch/arm/early_printk.c | 5 ++--- xen/arch/arm/head.S | 32 +++++++++++++++++++------------- xen/arch/arm/mm.c | 2 +- xen/arch/arm/setup.c | 2 -- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/xen/arch/arm/early_printk.c b/xen/arch/arm/early_printk.c index 3e51252..bdf4c0e 100644 --- a/xen/arch/arm/early_printk.c +++ b/xen/arch/arm/early_printk.c @@ -17,12 +17,11 @@ #ifdef EARLY_UART_ADDRESS -static void __init early_putch(char c) +void __init early_putch(char c) { volatile uint32_t *r; - r = (uint32_t *)((EARLY_UART_ADDRESS & 0x001fffff) - + XEN_VIRT_START + (1 << 21)); + r = (uint32_t *)(XEN_VIRT_START + (1 << 21)); /* XXX: assuming a PL011 UART. */ while(*(r + 0x6) & 0x8) diff --git a/xen/arch/arm/head.S b/xen/arch/arm/head.S index 9fdeda7..3d01be0 100644 --- a/xen/arch/arm/head.S +++ b/xen/arch/arm/head.S @@ -24,6 +24,7 @@ #define PT_PT 0xe7f /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=111, T=1, P=1 */ #define PT_MEM 0xe7d /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=111, T=0, P=1 */ #define PT_DEV 0xe71 /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=100, T=0, P=1 */ +#define PT_DEV_L3 0xe73 /* lev3: nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=100, T=1, P=1 */ #define PT_UPPER(x) (PT_##x & 0xf00) #define PT_LOWER(x) (PT_##x & 0x0ff) @@ -183,6 +184,16 @@ skip_bss: teq r12, #0 bne pt_ready + /* console fixmap */ + ldr r1, =xen_fixmap + add r1, r1, r10 /* r1 := paddr (xen_fixmap) */ + mov r3, #0 + lsr r2, r11, #12 + lsl r2, r2, #12 /* 4K aligned paddr of UART */ + orr r2, r2, #PT_UPPER(DEV_L3) + orr r2, r2, #PT_LOWER(DEV_L3) /* r2:r3 := 4K dev map including UART */ + strd r2, r3, [r1, #0] /* Map it in the first fixmap's slot */ + /* Build the baseline idle pagetable's first-level entries */ ldr r1, =xen_second add r1, r1, r10 /* r1 := paddr (xen_second) */ @@ -205,12 +216,13 @@ skip_bss: ldr r4, =start lsr r4, #18 /* Slot for vaddr(start) */ strd r2, r3, [r1, r4] /* Map Xen there too */ + #ifdef EARLY_UART_ADDRESS - ldr r3, =(1<<(54-32)) /* NS for device mapping */ - lsr r2, r11, #21 - lsl r2, r2, #21 /* 2MB-aligned paddr of UART */ - orr r2, r2, #PT_UPPER(DEV) - orr r2, r2, #PT_LOWER(DEV) /* r2:r3 := 2MB dev map including UART */ + /* xen_fixmap pagetable */ + ldr r2, =xen_fixmap + add r2, r2, r10 + orr r2, r2, #PT_UPPER(PT) + orr r2, r2, #PT_LOWER(PT) /* r2:r3 := paddr (xen_fixmap) */ add r4, r4, #8 strd r2, r3, [r1, r4] /* Map it in the fixmap's slot */ #else @@ -236,13 +248,9 @@ pt_ready: mov pc, r1 /* Get a proper vaddr into PC */ paging: + #ifdef EARLY_UART_ADDRESS - /* Recover the UART address in the new address space. */ - lsl r11, #11 - lsr r11, #11 /* UART base's offset from 2MB base */ - adr r0, start - add r0, r0, #0x200000 /* vaddr of the fixmap's 2MB slot */ - add r11, r11, r0 /* r11 := vaddr (UART base address) */ + ldr r11, =FIXMAP_ADDR(FIXMAP_CONSOLE) #endif PRINT("- Ready -\r\n") @@ -261,8 +269,6 @@ paging: mcr CP32(r0, BPIALL) /* Flush branch predictor */ dsb /* Ensure completion of TLB+BP flush */ isb - /* Now, the UART is in its proper fixmap address */ - ldrne r11, =FIXMAP_ADDR(FIXMAP_CONSOLE) /* Non-boot CPUs report that they've got this far */ ldr r0, =ready_cpus diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index b0068d2..d0cd2c9 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -37,7 +37,7 @@ struct domain *dom_xen, *dom_io; /* Static start-of-day pagetables that we use before the allocators are up */ lpae_t xen_pgtable[LPAE_ENTRIES] __attribute__((__aligned__(4096))); lpae_t xen_second[LPAE_ENTRIES*4] __attribute__((__aligned__(4096*4))); -static lpae_t xen_fixmap[LPAE_ENTRIES] __attribute__((__aligned__(4096))); +lpae_t xen_fixmap[LPAE_ENTRIES] __attribute__((__aligned__(4096))); static lpae_t xen_xenmap[LPAE_ENTRIES] __attribute__((__aligned__(4096))); /* Non-boot CPUs use this to find the correct pagetables. */ diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 7568968..6fbcb81 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -194,9 +194,7 @@ void __init start_xen(unsigned long boot_phys_offset, setup_pagetables(boot_phys_offset, get_xen_paddr()); #ifdef EARLY_UART_ADDRESS - /* Map the UART */ /* TODO Need to get device tree or command line for UART address */ - set_fixmap(FIXMAP_CONSOLE, EARLY_UART_ADDRESS >> PAGE_SHIFT, DEV_SHARED); pl011_init(0, FIXMAP_ADDR(FIXMAP_CONSOLE)); console_init_preirq(); #endif -- 1.7.2.5 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |