[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [PATCH v2 00/47] MINI-OS: enable the arm64 support



 1) Code.
   The work is based on Chen Baozi and Volodymyr's patches.
   I tested this patch set with my Softiron board.
   
   This patch set is based on the latest mini-os code:
    (git tree: git://xenbits.xen.org/mini-os.git
     The top is "093da7f mini-os: add config item for printing via hypervisor")

   Please check the code in tree:
   https://github.com/zyzii/mini-os (branch: arm64_v2_freeze) 

   After this patch set:
          1.) The scheduler for arm64 works fine.
          2.) The gic/timer for arm64 works fine.
   
   The log for the mini-os:
   =================================================
   (d2277) - Mini-OS booting -
   (d2277) - Setup CPU -
   (d2277) - Setup booting pagetable -
   (d2277) - MMU on -
   (d2277) - Setup stack -
   (d2277) - Jumping to C entry -
   (d2277) Virtual -> physical offset = 1000040000000 
   (d2277) Checking DTB at 0xffff000008000000...
   (d2277) Found GIC: gicd_base = 0xffff00ffc0000000, gicc_base = 
0xffff00ffc0001000
   (d2277) MM: Init
   (d2277)     _text:       0xffff000000000000(VA)
   (d2277)     _etext:      0xffff00000001c0e0(VA)
   (d2277)     _erodata:    0xffff000000023000(VA)
   (d2277)     _edata:      0xffff00000002e40c(VA)
   (d2277)     stack start: 0xffff00000002a000(VA)
   (d2277)     _end:        0xffff0000000378b8(VA)
   (d2277) Found memory at 0x40000000 (len 0x20000000)
   (d2277) Using pages 262205 to 393216 as free space for heap.
   (d2277) MM: Initialise page allocator for 
ffff00000003d000(4003d000)-ffff00001ffff000(5ffff000)
   (d2277)     Adding memory range 40049000-5ffff000
   (d2277) MM: done
   (d2277) Initialising timer interface
   (d2277) Virtual Count register is 525DE16, freq = 250000000 Hz
   (d2277) Initialising console ... done.
   (d2277) FDT suggests grant table base 38000000
   (d2277) gnttab_table mapped at 0xffff00ffc0003000.
   (d2277) Initialising scheduler
   (d2277) Thread "Idle": pointer: 0x0xffff00001fffe078, stack: 
0x0xffff00001fff8000
   (d2277) Thread "xenstore": pointer: 0x0xffff00001fffe0d8, stack: 
0x0xffff00000004c000
   (d2277) xenbus initialised on irq 1
   (d2277) Thread "shutdown": pointer: 0x0xffff00001fffe138, stack: 
0x0xffff00001fff0000
   (d2277) Test main: par=0
   (d2277) Thread "xenbus_tester": pointer: 0x0xffff00001fffe198, stack: 
0x0xffff00001fff4000
   (d2277) Thread "periodic_thread": pointer: 0x0xffff00001fffe1f8, stack: 
0x0xffff00001ffe0000
   (d2277) Thread "netfront": pointer: 0x0xffff00001fffe258, stack: 
0x0xffff00001ffe4000
   (d2277) Thread "blkfront": pointer: 0x0xffff00001fffe2b8, stack: 
0x0xffff00001ffe8000
   (d2277) Thread "fbfront": pointer: 0x0xffff00001fffe318, stack: 
0x0xffff00001ffec000
   (d2277) Thread "kbdfront": pointer: 0x0xffff00001fffe378, stack: 
0x0xffff000000050000
   (d2277) Thread "shutdown": pointer: 0x0xffff00001fffe3d8, stack: 
0x0xffff000000054000
   (d2277) Doing xenbus test.
   (d2277) Periodic thread started.
   =================================================

 2.) Tests  
   I tested this patch set on Softiron(arm64) and x86_64 platform.       
   (Please use "make CONFIG_USE_XEN_CONSOLE" to compile the minios.)
   
   In the Softiron, I did the Block Read/Write tests by enabling 
CONFIG_BLKFRONT.

 3.) Changes   
   v1 --> v2:
       0) make the DTC code as a subfolder, not a submodule.
       1) refactor the arm32 code, move it to a separate folder.
          Now the folder like this:
              arch/arm
              ├── arch.mk
              ├── arm32
              │   ├── arm32.S
              │   ├── hypercalls32.S
              │   └── minios-arm32.lds
              ├── arm64
              │   ├── arm64.S
              │   ├── asm.h
              │   ├── hypercalls64.S
              │   ├── minios-arm64.lds.S
              │   └── traps.c
              ├── balloon.c
              ├── events.c
              ├── gic.c
              ├── Makefile
              ├── mm.c
              ├── panic.c
              ├── sched.c
              ├── setup.c
              └── time.c
       2) fix the bug in scheduler.
       3) rewrite some GPL code, by copying and re-writing the FreeBSD code.
       4) implement the mmap/munmap(see the map_frame_ex/unmap_frames).
       5) change the mapping from 39bit to 48bit.
          rewrite some assembly code for booting. Use physical address
       7) change some code for "removing the e280 code from common place"
       8) change code in the parsing GIC information.
       9) move timer code to separate folder, such as arch/arm/arm32/time.h
       10) change the logic in to_virt.
       11) add mapping for GNT table.
       12) change the virtual memory layout to:
           /*
            * The virtual address layout for arm64(48bit):
            *
            *      
--------------------------------------------------------------------------
            *     |                                                             
             |
            *      
--------------------------------------------------------------------------
            *     ^                   ^                   ^                 ^   
             ^
            *     |<-- memory area -->|<-- kernel area -->|<- demand area ->|<- 
heap area -> |
            *     ^
            *     ^
            *     |
            * (0xffff000000000000, when TCR.T0SZ == 16)
            *
            * memory area (0xffff000000000000 ~ VIRT_KERNEL_AREA)   : used for 
linear physical memory mapping
            * kernel area (VIRT_KERNEL_AREA   ~ VIRT_DEMAND_AREA)   : used for 
map_frame_virt
            * demand area (VIRT_DEMAND_AREA   ~ VIRT_HEAP_AREA)     : used for 
ioremap
            * heap area   (VIRT_HEAP_AREA     ~ 0xffffffffffffffff) : used for 
heap
            */
           
           The code is put at 0xffff000000000000.
       13) Add memory size limits, such as MIN_MEM_SIZE/MAX_MEM_SIZE
       14) others

  4.) The comments from Julien which I did not follow:
     0) Use p2m_set_entry to setup the page table.
        I did not have good understanding of the p2m_set_entry().
        So I use my familiar way to setup the page table.

     1) Move dsb/dmb/mb to common place.
        I did not do so, because I found the older arm32 archs
        use "mcr" to do the memory barriers.    
        (I will add extra patch to fix this...)

Huang Shijie (47):
  mini-os: fix the wrong parameter for map_free() in
    init_page_allocator()
  arm32: move the arm32 code to arm32 folder
  mini-os: replace the L1_PAGETABLE_SHIFT with PAGE_SHIFT
  mini-os: rename the L1_PROT to DEF_PAGE_PROT
  arm: create a new header for the page macros
  arm64: add the boot code
  arm64: change physical_address_offset to paddr_t
  arm64: fix the wrong mask for to_virt/to_phys
  arm64: add the __PAGE_SIZE macro in header file
  arm64: add exception support
  arm64: dump the registers for do_bad_mode()/do_sync()
  arm32: move arm32 specific code to a separate header
  arm64: add the basic helpers for arm64
  arm64: define the quad_t for arm64
  arm64: time.c: fix the wrong format for printk
  mini-os: define ULONG_MAX/LONG_MAX for arm64
  mini-os: remove the e820 from common code
  arm64: mm.c: fix the compiler error
  arm64: refine the arch_init_mm
  arm64: add shared_info support
  mini-os: implement the memmove/memchr
  arm64: define the CALLEE_SAVED_REGISTERS
  arm64: implement the __arch_switch_threads
  arm64: implement the arm_start_thread
  arm64: change sp to "unsigned long" type
  arm64: fix the wrong size of the register
  arm64: implement the run_idle_thread
  arm64: add the hypercall support
  arm64: init the memory system
  arm64: set the mapping for console and xenbus
  arm: add a new helper ioremap
  arm64: implement the mmap/munmap
  arm64: add the virtual address layout description
  arm: parse out the address/size for gicd/gicc
  arm32: gic: move REG_WRITE32/REG_READ32 to a separate header
  arm64: gic: implement the REG_WRITE32/REG_READ32
  arm32: move several timer functions to a separate header
  arm32: add a new helper read_frequency()
  arm64: implement the timer helpers for arm64
  arm64: add the link file
  arm64: add the makefile
  mini-os: Set TARGET_ARCH_FAM for arm64
  mini-os: create the image for arm
  mini-os: add the libfdt library
  arm64: fix the compilor error in time
  arm: add mapping for GNT table
  mini-os: update the .gitignore

 .gitignore                        |    5 +
 Config.mk                         |    7 +-
 Makefile                          |   34 +-
 arch/arm/Makefile                 |   29 +
 arch/arm/arch.mk                  |    7 +
 arch/arm/arm32.S                  |  294 ------
 arch/arm/arm32/arm32.S            |  294 ++++++
 arch/arm/arm32/hypercalls32.S     |   64 ++
 arch/arm/arm32/minios-arm32.lds   |   83 ++
 arch/arm/arm64/arm64.S            |  491 ++++++++++
 arch/arm/arm64/asm.h              |   18 +
 arch/arm/arm64/hypercalls64.S     |   81 ++
 arch/arm/arm64/minios-arm64.lds.S |   81 ++
 arch/arm/arm64/traps.c            |   44 +
 arch/arm/gic.c                    |  104 +-
 arch/arm/hypercalls32.S           |   64 --
 arch/arm/minios-arm32.lds         |   83 --
 arch/arm/mm.c                     |  457 ++++++++-
 arch/arm/sched.c                  |   27 +-
 arch/arm/setup.c                  |    7 +-
 arch/arm/time.c                   |   40 +-
 arch/x86/mm.c                     |   22 +-
 include/arm/arch_limits.h         |    4 +-
 include/arm/arch_mm.h             |   65 +-
 include/arm/arm32/io.h            |   18 +
 include/arm/arm32/os.h            |   34 +
 include/arm/arm32/time.h          |   35 +
 include/arm/arm32/traps.h         |   20 +
 include/arm/arm64/io.h            |   18 +
 include/arm/arm64/os.h            |   75 ++
 include/arm/arm64/pagetable.h     |  108 +++
 include/arm/arm64/time.h          |   34 +
 include/arm/arm64/traps.h         |   27 +
 include/arm/os.h                  |   58 +-
 include/arm/page_def.h            |    8 +
 include/arm/traps.h               |   20 -
 include/console.h                 |    8 +
 include/events.h                  |    9 +-
 include/hypervisor.h              |    7 +
 include/mm.h                      |    3 +
 include/posix/limits.h            |    2 +-
 include/types.h                   |    2 +-
 include/x86/arch_mm.h             |    2 +
 lib/libfdt/Makefile.libfdt        |   11 +
 lib/libfdt/TODO                   |    3 +
 lib/libfdt/fdt.c                  |  251 +++++
 lib/libfdt/fdt.h                  |  111 +++
 lib/libfdt/fdt_addresses.c        |   96 ++
 lib/libfdt/fdt_empty_tree.c       |   83 ++
 lib/libfdt/fdt_overlay.c          |  861 +++++++++++++++++
 lib/libfdt/fdt_ro.c               |  703 ++++++++++++++
 lib/libfdt/fdt_rw.c               |  505 ++++++++++
 lib/libfdt/fdt_strerror.c         |  102 ++
 lib/libfdt/fdt_sw.c               |  300 ++++++
 lib/libfdt/fdt_wip.c              |  139 +++
 lib/libfdt/libfdt.h               | 1899 +++++++++++++++++++++++++++++++++++++
 lib/libfdt/libfdt_env.h           |  143 +++
 lib/libfdt/libfdt_internal.h      |   95 ++
 lib/libfdt/version.lds            |   71 ++
 lib/memmove.c                     |   44 +
 lib/string.c                      |   12 +
 minios.mk                         |    4 +
 mm.c                              |   13 +-
 xenbus/xenbus.c                   |    8 +
 64 files changed, 7706 insertions(+), 641 deletions(-)
 create mode 100644 arch/arm/Makefile
 create mode 100644 arch/arm/arch.mk
 delete mode 100644 arch/arm/arm32.S
 create mode 100644 arch/arm/arm32/arm32.S
 create mode 100644 arch/arm/arm32/hypercalls32.S
 create mode 100755 arch/arm/arm32/minios-arm32.lds
 create mode 100644 arch/arm/arm64/arm64.S
 create mode 100644 arch/arm/arm64/asm.h
 create mode 100644 arch/arm/arm64/hypercalls64.S
 create mode 100644 arch/arm/arm64/minios-arm64.lds.S
 create mode 100644 arch/arm/arm64/traps.c
 delete mode 100644 arch/arm/hypercalls32.S
 delete mode 100755 arch/arm/minios-arm32.lds
 create mode 100644 include/arm/arm32/io.h
 create mode 100644 include/arm/arm32/os.h
 create mode 100644 include/arm/arm32/time.h
 create mode 100644 include/arm/arm32/traps.h
 create mode 100644 include/arm/arm64/io.h
 create mode 100644 include/arm/arm64/os.h
 create mode 100644 include/arm/arm64/pagetable.h
 create mode 100644 include/arm/arm64/time.h
 create mode 100644 include/arm/arm64/traps.h
 create mode 100644 include/arm/page_def.h
 delete mode 100644 include/arm/traps.h
 create mode 100644 lib/libfdt/Makefile.libfdt
 create mode 100644 lib/libfdt/TODO
 create mode 100644 lib/libfdt/fdt.c
 create mode 100644 lib/libfdt/fdt.h
 create mode 100644 lib/libfdt/fdt_addresses.c
 create mode 100644 lib/libfdt/fdt_empty_tree.c
 create mode 100644 lib/libfdt/fdt_overlay.c
 create mode 100644 lib/libfdt/fdt_ro.c
 create mode 100644 lib/libfdt/fdt_rw.c
 create mode 100644 lib/libfdt/fdt_strerror.c
 create mode 100644 lib/libfdt/fdt_sw.c
 create mode 100644 lib/libfdt/fdt_wip.c
 create mode 100644 lib/libfdt/libfdt.h
 create mode 100644 lib/libfdt/libfdt_env.h
 create mode 100644 lib/libfdt/libfdt_internal.h
 create mode 100644 lib/libfdt/version.lds
 create mode 100644 lib/memmove.c

-- 
2.7.4


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.