Changeset 06f10ac in mainline for kernel/arch/arm64/include


Ignore:
Timestamp:
2021-08-22T19:08:44Z (4 years ago)
Author:
Martin Decky <martin@…>
Branches:
master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c21cc26
Parents:
95b7d4df
Message:

Implement support for HiKey 960

Initial support for the 96Boards HiKey 960 board.

  • The kernel identity mapping has been extended to 4 GiB. The initial bootstrap mapping maps 3 GiB as nornal memory and the next 1 GiB as device memory to support early UART debugging output.
  • The istate_t has been padded in order to preserve the stack pointer alignment invariant.

The current implementation is limited to UP and UART input/output.

Location:
kernel/arch/arm64/include/arch
Files:
5 edited
1 moved

Legend:

Unmodified
Added
Removed
  • kernel/arch/arm64/include/arch/barrier.h

    r95b7d4df r06f10ac  
    3737#define KERN_arm64_BARRIER_H_
    3838
    39 #include <stddef.h>
    40 
    41 #define COHERENCE_INVAL_MIN  4
    42 
    43 /** Ensure visibility of instruction updates for a multiprocessor.
    44  *
    45  * @param addr Address of the first instruction.
    46  * @param size Size of the instruction block (in bytes).
    47  */
    48 static inline void ensure_visibility(void *addr, size_t len)
    49 {
    50         size_t i;
    51 
    52         /*
    53          * Clean to Point of Unification to make the new instructions visible to
    54          * the instruction cache.
    55          */
    56         for (i = 0; i < len; i += COHERENCE_INVAL_MIN)
    57                 asm volatile (
    58                     "dc cvau, %[addr]\n"
    59                     : : [addr] "r" ((char *) addr + i)
    60                 );
    61 
    62         /* Ensure completion on all PEs. */
    63         asm volatile ("dsb ish" ::: "memory");
    64 
    65         /* Ensure instruction cache/branch predictor discards stale data. */
    66         for (i = 0; i < len; i += COHERENCE_INVAL_MIN)
    67                 asm volatile (
    68                     "ic ivau, %[addr]\n"
    69                     : : [addr] "r" ((char *) addr + i)
    70                 );
    71 
    72         /* Ensure completion on all PEs. */
    73         asm volatile ("dsb ish" ::: "memory");
    74 
    75         /* Synchronize context on this PE. */
    76         asm volatile ("isb");
    77 }
    78 
    7939#endif
    8040
  • kernel/arch/arm64/include/arch/istate_struct.h

    r95b7d4df r06f10ac  
    6565#define ISTATE_OFFSET_X29    0x108
    6666#define ISTATE_OFFSET_X30    0x110
    67 #define ISTATE_SIZE          0x118
     67#define ISTATE_OFFSET_PAD0   0x118
     68#define ISTATE_SIZE          0x120
    6869
    6970#ifndef __ASSEMBLER__
     
    109110        /* Link Register. */
    110111        uint64_t x30;
     112
     113        /*
     114         * ARM64 mandates that the stack pointer is always aligned to
     115         * a 16-byte boundary. To satisfy this condition, the size of
     116         * this data structure needs to be also a multiple of 16 bytes.
     117         * This is the reason for this padding.
     118         */
     119        uint64_t pad0;
    111120} istate_t;
    112121
    113122#endif
     123
    114124#endif
  • kernel/arch/arm64/include/arch/mach/hikey960/hikey960.h

    r95b7d4df r06f10ac  
    11/*
    2  * Copyright (c) 2019 Petr Pavlu
     2 * Copyright (c) 2021 Martin Decky
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 #include <arch/barrier.h>
    30 #include <barrier.h>
     29/** @addtogroup kernel_arm64_hikey960
     30 * @brief HiKey 960 platform.
     31 * @ingroup kernel_arm64
     32 * @{
     33 */
     34/** @file
     35 * @brief HiKey 960 platform driver.
     36 */
    3137
    32 void smc_coherence(void *a, size_t l)
    33 {
    34         ensure_visibility(a, l);
    35 }
     38#ifndef KERN_arm64_mach_hikey960_H_
     39#define KERN_arm64_mach_hikey960_H_
     40
     41#include <arch/machine_func.h>
     42
     43extern struct arm_machine_ops hikey960_machine_ops;
     44
     45#endif
     46
     47/** @}
     48 */
  • kernel/arch/arm64/include/arch/mach/virt/virt.h

    r95b7d4df r06f10ac  
    3636 */
    3737
    38 #ifndef KERN_arm64_virt_H_
    39 #define KERN_arm64_virt_H_
     38#ifndef KERN_arm64_mach_virt_H_
     39#define KERN_arm64_mach_virt_H_
    4040
    4141#include <arch/machine_func.h>
  • kernel/arch/arm64/include/arch/mm/km.h

    r95b7d4df r06f10ac  
    4141#include <typedefs.h>
    4242
    43 #define KM_ARM64_IDENTITY_START  UINT64_C(0xffffffff80000000)
    44 #define KM_ARM64_IDENTITY_SIZE   UINT64_C(0x0000000080000000)
     43#define KM_ARM64_IDENTITY_START  UINT64_C(0xffffffff00000000)
     44#define KM_ARM64_IDENTITY_SIZE   UINT64_C(0x0000000100000000)
    4545
    4646#define KM_ARM64_NON_IDENTITY_START  UINT64_C(0xffff000000000000)
    47 #define KM_ARM64_NON_IDENTITY_SIZE   UINT64_C(0x0000ffff80000000)
     47#define KM_ARM64_NON_IDENTITY_SIZE   UINT64_C(0x0000ffff00000000)
    4848
    4949extern void km_identity_arch_init(void);
     
    5353#else /* __ASSEMBLER__ */
    5454
    55 #define KM_ARM64_IDENTITY_START  0xffffffff80000000
    56 #define KM_ARM64_IDENTITY_SIZE   0x0000000080000000
     55#define KM_ARM64_IDENTITY_START  0xffffffff00000000
     56#define KM_ARM64_IDENTITY_SIZE   0x0000000100000000
    5757
    5858#define KM_ARM64_NON_IDENTITY_START  0xffff000000000000
    59 #define KM_ARM64_NON_IDENTITY_SIZE   0x0000ffff80000000
     59#define KM_ARM64_NON_IDENTITY_SIZE   0x0000ffff00000000
    6060
    6161#endif /* __ASSEMBLER__ */
  • kernel/arch/arm64/include/arch/mm/page.h

    r95b7d4df r06f10ac  
    5353
    5454#define KA2PA(x) \
    55         (((uintptr_t) (x)) - UINT64_C(0xffffffff80000000) + physmem_base)
     55        (((uintptr_t) (x)) - UINT64_C(0xffffffff00000000) + physmem_base)
    5656#define PA2KA(x) \
    57         (((uintptr_t) (x)) + UINT64_C(0xffffffff80000000) - physmem_base)
     57        (((uintptr_t) (x)) + UINT64_C(0xffffffff00000000) - physmem_base)
    5858
    5959#endif /* __ASSEMBLER__ */
Note: See TracChangeset for help on using the changeset viewer.