Chinaunix首页 | 论坛 | 博客
  • 博客访问: 22168
  • 博文数量: 10
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 140
  • 用 户 组: 普通用户
  • 注册时间: 2014-03-05 00:47
文章分类

全部博文(10)

文章存档

2015年(1)

2014年(9)

我的朋友

分类: 虚拟化

2014-12-30 12:03:37



  1. Xen 4.4-rc2
  2. (XEN) Xen version 4.4-rc2 (uty@localdomain) (arm-unknown-linux-gnueabi-gcc (GCC) 4.6.3) debug=y Tue Dec 16 22:03:20 CST 2014
  3. (XEN) Latest ChangeSet: Thu Feb 6 12:20:48 2014 +0100 git:fee6163-dirty
  4. (XEN) Console output is synchronous.
  5. (XEN) Processor: 410fc0f4: "ARM Limited", variant: 0x0, part 0xc0f, rev 0x4
  6. (XEN) 32-bit Execution:
  7. (XEN) Processor Features: 00001031:00011011
  8. (XEN) Instruction Sets: AArch32 Thumb Thumb-2 ThumbEE Jazelle
  9. (XEN) Extensions: GenericTimer Security
  10. (XEN) Debug Features: 02010555
  11. (XEN) Auxiliary Features: 00000000
  12. (XEN) Memory Model Features: 10201105 20000000 01240000 02102211
  13. (XEN) ISA Features: 02101110 13112111 21232041 11112131 10011142 00000000
  14. (XEN) Platform: SAMSUNG EXYNOS5
  15. (XEN) Set SYSRAM to 00000000bfe0004c (0020004c)
  16. (XEN) Generic Timer IRQ: phys=30 hyp=26 virt=27
  17. (XEN) uty: in exynos5_init_time() !!!!!!!!!!!
  18. (XEN) Using generic timer at 24000 KHz
  19. (XEN) GIC initialization:
  20. (XEN) gic_dist_addr=0000000010481000
  21. (XEN) gic_cpu_addr=0000000010482000
  22. (XEN) gic_hyp_addr=0000000010484000
  23. (XEN) gic_vcpu_addr=0000000010486000
  24. (XEN) gic_maintenance_irq=25
  25. (XEN) GIC: 160 lines, 2 cpus, secure (IID 0200043b).
  26. (XEN) Using scheduler: SMP Credit Scheduler (credit)
  27. (XEN) Allocated console ring of 16 KiB.
  28. (XEN) VFP implementer 0x41 architecture 4 part 0x30 variant 0xf rev 0x0
  29. (XEN) Bringing up CPU1
  30. (XEN) CPU 1 booted.
  31. (XEN) Brought up 2 CPUs
  32. (XEN) *** LOADING DOMAIN 0 ***
  33. (XEN) Populate P2M 0x80000000->0xa0000000 (1:1 mapping for dom0)
  34. (XEN) uty: early_info.modules.nr_mods 2, MOD_KERNEL 2
  35. (XEN) Loading kernel from boot module 2
  36. (XEN) Loading zImage from 0000000060000000 to 0000000087c00000-0000000087fb9640
  37. (XEN) Loading dom0 DTB to 0x0000000088000000-0x0000000088008428
  38. (XEN) Scrubbing Free RAM: ...............done.
  39. (XEN) Initial low memory virq threshold set at 0x4000 pages.
  40. (XEN) Std. Loglevel: All
  41. (XEN) Guest Loglevel: All
  42. (XEN) **********************************************
  43. (XEN) ******* WARNING: CONSOLE OUTPUT IS SYNCHRONOUS
  44. (XEN) ******* This option is intended to aid debugging of Xen by ensuring
  45. (XEN) ******* that all output is synchronously delivered on the serial line.
  46. (XEN) ******* However it can introduce SIGNIFICANT latencies and affect
  47. (XEN) ******* timekeeping. It is NOT recommended for production use!
  48. (XEN) **********************************************
  49. (XEN) 3... 2... 1...
  50. (XEN) *** Serial input -> DOM0 (type 'CTRL-a' three times to switch input to Xen)
  51. (XEN) Freed 264kB init memory.
  52. (XEN) DOM0: Uncompressing Linux... done, booting the kernel.
  53. (XEN) DOM0: <6>Initializing cgroup subsys cpu
  54. (XEN) DOM0: <5>Linux version 3.0.31-g3370a7c-dirty (uty@localhost.localdomain) (gcc version 4.6.x-google 20120106 (prerelease) (GCC) ) #30
  55. (XEN) DOM0: SMP PREEMPT Tue Dec 30 01:29:24 CST 2014
  56. (XEN) DOM0: CPU: ARMv7 Processor [410fc0f4] revision 4 (ARMv7), cr=10c5387d
  57. (XEN) DOM0: CPU: VIPT nonaliasing data cache, VIPT aliasing instruction cache
  58. (XEN) DOM0: <6>Machine: ARNDALE, model: Insignal Arndale evaluation board based on EXYNOS5250
  59. (XEN) DOM0: uty: arm_add_memory start 0x80000000 size 0x20000000
  60. (XEN) DOM0: <6>debug: ignoring loglevel setting.
  61. (XEN) DOM0: Memory policy: ECC disabled, Data cache writealloc
  62. (XEN) DOM0: uty: build_mem_type_table end
  63. (XEN) DOM0: uty: build_mem_type_table end
  64. (XEN) DOM0: uty: prepare_page_table end
  65. (XEN) DOM0: uty: prepare_page_table end
  66. (XEN) DOM0: uty: map_lowmem end
  67. (XEN) DOM0: uty: map_lowmem end
  68. (XEN) DOM0: uty:in devicemaps_init
  69. (XEN) DOM0: uty:in devicemaps_init 2
  70. (XEN) DOM0: uty: early_alloc for vectors_page OK
  71. (XEN) DOM0: uty: test for early_printk
  72. (XEN) DOM0: CPU EXYNOS5250 (id 0x43520010)
  73. (XEN) DOM0: <4>BUG: not creating mapping for 0x00000000 at 0x00000000 in user region
  74. (XEN) DOM0: <7>exynos5_init_clocks: initializing clocks
  75. (XEN) DOM0: <6>S3C24XX Clocks, Copyright 2004 Simtec Electronics
  76. (XEN) DOM0: <3>s3c_register_clksrc: clock audiocdclk has no registers set
  77. (XEN) DOM0: <3>audiocdclk: no parent clock specified
  78. (XEN) DOM0: <7>exynos5_setup_clocks: registering clocks
  79. (XEN) DOM0: <7>exynos5_setup_clocks: xtal is 24000000
  80. (XEN) DOM0: <6>EXYNOS5: PLL settings, A=1000000000, B=800000000, C=333000000
  81. (XEN) DOM0: M=1600000000, E=96000000, V=300000000, G=533000000
  82. (XEN) DOM0: <6>EXYNOS5: ARMCLK=1000000000, CDREX=800000000, ACLK400=24000000
  83. (XEN) DOM0: ACLK333=333000000, ACLK266=266666666, ACLK200=200000000
  84. (XEN) DOM0: ACLK166=166500000, ACLK66=66666666
  85. (XEN) DOM0: <6>uclk1: source is mout_mpll_user (6), rate is 100000000
  86. (XEN) DOM0: <6>uclk1: source is mout_mpll_user (6), rate is 100000000
  87. (XEN) DOM0: <6>uclk1: source is mout_mpll_user (6), rate is 100000000
  88. (XEN) DOM0: <6>uclk1: source is mout_mpll_user (6), rate is 100000000
  89. (XEN) DOM0: <6>sclk_usbdrd30: source is mout_mpll (0), rate is 66666666
  90. (XEN) DOM0: <6>sclk_fimd: source is mout_mpll_user (6), rate is 800000000
  91. (XEN) DOM0: <6>aclk_266_gscl: source is aclk_266 (1), rate is 266666666
  92. (XEN) DOM0: <6>sclk_g3d: source is mout_mpll_user (0), rate is 800000000
  93. (XEN) DOM0: <6>sclk_sata: source is mout_mpll_user (0), rate is 66666666
  94. (XEN) DOM0: <6>sclk_gscl_wrap0: source is ext_xtal (0), rate is 24000000
  95. (XEN) DOM0: <6>sclk_gscl_wrap1: source is ext_xtal (0), rate is 24000000
  96. (XEN) DOM0: <6>sclk_cam0: source is ext_xtal (0), rate is 24000000
  97. (XEN) DOM0: <6>sclk_cam1: source is ext_xtal (0), rate is 24000000
  98. (XEN) DOM0: uty: mdesc->map_io OK
  99. (XEN) DOM0: uty: mdesc->map_io OK
  100. (XEN) DOM0: uty: devicemaps_init end
  101. (XEN) DOM0: uty: devicemaps_init end
  102. (XEN) DOM0: uty: kmap_init end
  103. (XEN) DOM0: uty: kmap_init end
  104. (XEN) DOM0: <2>kernel BUG at mm/bootmem.c:353!
昨晚跑到这了,确实是early_printk的问题。感觉原因是这样,虽然mdesc->map_io里面最终又重新map了UART,但在map_io里面初始化了串口,这就比较复杂了,因为xen虚拟的串口只是最简单的2个寄存器,如果复杂了,访问其它的串口寄存器应该就会出错了,而后面的代码会用printk。没有在xen里打印出信息来看,不过感觉应该是这样了。
开始只是把初始化串口的代码注释掉了,并且把arndale_map_io之前的early_printk也都注释了,为得是在UART没有map好前不碰它。现在想想devicemaps_init()注释里说的一切调试方法都不能用了,是指的early_printk、printk的。

  1. 1285 static void __init arndale_map_io(void)
  2. 1286 {
  3. 1287    clk_xxti.rate = 24000000;
  4. 1288    s5p_init_io(NULL, 0, S5P_VA_CHIPID);
  5. 1289    s3c24xx_init_clocks(24000000);
  6. 1290    // uty:test
  7. 1291
  8. 1292    //s3c24xx_init_uarts(arndale_uartcfgs, ARRAY_SIZE(arndale_uartcfgs));
  9. 1293    exynos_reserve_mem();
  10. 1294 }
但这时候还是不行。比较郁闷,既跑不出来又不能看哪出错了。现在想想有个地方很奇怪,在s3c24xx_init_clocks()函数里就调用printk了,可这是在初始化串口之前。估计是系统有套机制,当串口驱动还没有跑起来之前,printk都先用简单的方式。没有跟着看这个。可能是跟earlyconsole什么的有关,驱动没起来前是用的early console?不懂。

为了看输出,只有最先初始化UART的内存映射了,所以把arch/arm/mach-exynos/cpu-exynos5.c里exynos5_iodesc中UART的部分注释掉,然后提前映射了UART的IO

  1.  921 static void __init devicemaps_init(struct machine_desc *mdesc)
  2.  922 {
  3.  923     struct map_desc map;
  4.  924     unsigned long addr;
  5.  925
  6.  926     early_printk("uty:in devicemaps_init\n");
  7.  927     early_printk("uty:in devicemaps_init 2\n");
  8.  928     /*
  9.  929      * Allocate the vector page early.
  10.  930       */
  11.  931     vectors_page = early_alloc(PAGE_SIZE);
  12.  932     early_printk("uty: early_alloc for vectors_page OK\n");
  13.  933
  14.  934     for (addr = VMALLOC_END; addr; addr += PGDIR_SIZE) {
  15.  935         //early_printk("uty: addr=0x%x\n", (unsigned int)addr);
  16.  936         //early_printk("uty: pmd=0x%x\n", (unsigned int)pmd_off_k(addr));
  17.  937         pmd_clear(pmd_off_k(addr));
  18.  938     }
  19.  939
  20.  940     //early_printk("uty: clear VMALLOC_END above pmd\n");
  21.  941
  22.  942     // uty: test
  23.  943     map.pfn = __phys_to_pfn(S3C_PA_UART);
  24.  944     map.virtual = (unsigned long)S3C_VA_UART;
  25.  945     map.length = SZ_512K;
  26.  946     map.type = MT_DEVICE;
  27.  947     create_mapping(&map);
  28.  948
  29.  949     early_printk("uty: test for early_printk\n");
运气真好,跑过去了,就是最上面的log的样子。但奇怪的是为什么一开始注释了map_io之前的early_printk怎么不行。难道是exynos5_iodesc里面的io地址都没有初始化?如果是这样,那就是因为CPU的id得到的不对?但是后面输出有(XEN) DOM0: CPU EXYNOS5250 (id 0x43520010)这句啊。
在arch/arm/plat-samsung/init.c里,cpu->map_io()是映射exynos5_iodesc里的IO地址,包括UART的。在这之前确实有句printk,但为什么这个kernel之前直接在板子上跑的时候没问题呢?
难道是prink有什么缓存机制?确实bootmem现在还有问题,而printk也用到里bootmem。但如果是因为bootmem这里的问题,那现在printk应该也不正常啊。

  1. 46 void __init s3c_init_cpu(unsigned long idcode,
  2.  47 struct cpu_table *cputab, unsigned int cputab_size)
  3.  48 {
  4.  49 cpu = s3c_lookup_cpu(idcode, cputab, cputab_size);
  5.  50
  6.  51 if (cpu == NULL) {
  7.  52 printk(KERN_ERR "Unknown CPU type 0x%08lx\n", idcode);
  8.  53 panic("Unknown S3C24XX CPU");
  9.  54 }
  10.  55
  11.  56 printk("CPU %s (id 0x%08lx)\n", cpu->name, idcode);
  12.  57
  13.  58 if (cpu->map_io == NULL || cpu->init == NULL) {
  14.  59 printk(KERN_ERR "CPU %s support not enabled\n", cpu->name);
  15.  60 panic("Unsupported Samsung CPU");
  16.  61 }
  17.  62
  18.  63 cpu->map_io();
  19.  64 }
现在这样感觉是提前map里UART,连printk什么的都能用里,所以说很幸运。
在start_kernel()里很早就有
487     printk(KERN_NOTICE "%s", linux_banner);
这时候printk就可以用了。 这部分还没有搞清楚,还得看。

说下IO空间的初始化,platform和cpu的部分是分开的。
arch/arm/mm/mmu.c里
devicemaps_init()里调用mdesc->map_io()
对应的map_io()是arndale_map_io(),实现在arch/arm/mach-exynos/mach-arndale.c里
arndale_map_io()里又调用s5p_init_io()
s5p_init_io()实现在arch/arm/plat-s5p/cpu.c 看名字是个板级的。在里面,首先iotable_init(exynos5_iodesc)映射了一批IO

  1. 110 /* minimal IO mapping */
  2. 111
  3. 112 static struct map_desc s5p_iodesc[] __initdata = {
  4. 113 {
  5. 114 .virtual = (unsigned long)S5P_VA_CHIPID,
  6. 115 .pfn = __phys_to_pfn(S5P_PA_CHIPID),
  7. 116 .length = SZ_4K,
  8. 117 .type = MT_DEVICE,
  9. 118 }, {
  10. 119 .virtual = (unsigned long)S3C_VA_SYS,
  11. 120 .pfn = __phys_to_pfn(S5P_PA_SYSCON),
  12. 121 .length = SZ_64K,
  13. 122 .type = MT_DEVICE,
  14. 123 }, {
  15. 124 .virtual = (unsigned long)S3C_VA_TIMER,
  16. 125 .pfn = __phys_to_pfn(S5P_PA_TIMER),
  17. 126 .length = SZ_16K,
  18. 127 .type = MT_DEVICE,
  19. 128 }, {
  20. 129 .virtual = (unsigned long)S3C_VA_WATCHDOG,
  21. 130 .pfn = __phys_to_pfn(S3C_PA_WDT),
  22. 131 .length = SZ_4K,
  23. 132 .type = MT_DEVICE,
  24. 133 }, {
  25. 134 .virtual = (unsigned long)S5P_VA_SROMC,
  26. 135 .pfn = __phys_to_pfn(S5P_PA_SROMC),
  27. 136 .length = SZ_4K,
  28. 137 .type = MT_DEVICE,
  29. 138 }, {
  30. 139 .virtual = (unsigned long)S3C_VA_HSPHY,
  31. 140 .pfn = __phys_to_pfn(S5P_PA_HSPHY),
  32. 141 .length = SZ_4K,
  33. 142 .type = MT_DEVICE,
  34. 143 },
  35. 144 };
这些不是exynos5 cpu上的设备吗,不懂,貌似TIMER WATCHDOG这些不是吧,以后得每个都拿出来好好看看。
然后再调用s3c_init_cpu(),里面得到cpu id,找到对应的cpu类型后再调用cpu->map_io()。
cpu的map_io就是arch/arm/mach-exynos/cpu-exynos5.c里的exynos5_map_io()。看起来还是挺好理解的,先调用arndale_map_io,然后里面再调用exynos5_map_io,先板子,后芯片。
exynos5_map_io()里iotable_init(exynos5_iodesc)。这里面的就是芯片相关的了,并且IO特别多,UART也在里面。
也是先s5p_iodesc后exynos5_iodesc。



阅读(474) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~