如何从linux内核--ubuntu系统cmdline上预留DDR物理内存DMA

luther@gliethttp:~$ vim /proc/iomem
00100000-5bf0ffff : System RAM
00100000-00575553 : Kernel code
00575554-0078d307 : Kernel data
0081a000-008a809f : Kernel bss
可以看到kernel code和data,bss使用的ram就是我们的系统内存,
luther@gliethttp:~$ dmesg也可以看到物理内存的情况
BIOS-provided physical RAM map:
[    0.000000]  BIOS-e820: 0000000000000000 - 000000000009dc00 (usable)
[    0.000000]  BIOS-e820: 000000000009dc00 - 00000000000a0000 (reserved)
[    0.000000]  BIOS-e820: 00000000000d2000 - 0000000000100000 (reserved)
[    0.000000]  BIOS-e820: 0000000000100000 - 000000005bf10000 (usable)
[    0.000000]  BIOS-e820: 000000005bf10000 - 000000005bf19000 (ACPI data)
[    0.000000]  BIOS-e820: 000000005bf19000 - 000000005bf80000 (ACPI NVS)
[    0.000000]  BIOS-e820: 000000005bf80000 - 0000000060000000 (reserved)
[    0.000000]  BIOS-e820: 00000000e0000000 - 00000000f0000000 (reserved)
[    0.000000]  BIOS-e820: 00000000fec00000 - 00000000fec10000 (reserved)
[    0.000000]  BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved)
[    0.000000]  BIOS-e820: 00000000fff80000 - 0000000100000000 (reserved)
luther@gliethttp:~$ vim /proc/meminfo
MemTotal:        1478540 kB
MemFree:          868544 kB
Buffers:           31084 kB
Cached:           321672 kB
SwapCached:            0 kB

luther@gliethttp:~$ sudo vim /boot/grub/grub.cfg
原来的
linux    /boot/vmlinuz-2.6.31-14-generic root=UUID=9a04b75d-22f4-4100-a8b0-a07ef00ead04 ro   quiet splash
新改的
linux    /boot/vmlinuz-2.6.31-14-generic root=UUID=9a04b75d-22f4-4100-a8b0-a07ef00ead04 ro   quiet splash  mem=1442M

修改之后dmesg将多出如下一行提示:
[    0.000000] user-defined physical RAM map:
[    0.000000]  user: 0000000000000000 - 000000000009dc00 (usable)
[    0.000000]  user: 000000000009dc00 - 00000000000a0000 (reserved)
[    0.000000]  user: 00000000000d2000 - 0000000000100000 (reserved)
[    0.000000]  user: 0000000000100000 - 000000005a200000 (usable)
[    0.000000]  user: 000000005bf10000 - 000000005bf19000 (ACPI data)
[    0.000000]  user: 000000005bf19000 - 000000005bf80000 (ACPI NVS)
[    0.000000]  user: 000000005bf80000 - 0000000060000000 (reserved)
[    0.000000]  user: 00000000e0000000 - 00000000f0000000 (reserved)
[    0.000000]  user: 00000000fec00000 - 00000000fec10000 (reserved)
[    0.000000]  user: 00000000fee00000 - 00000000fee01000 (reserved)
[    0.000000]  user: 00000000fff80000 - 0000000100000000 (reserved)

之前
[    0.000000] 583MB HIGHMEM available.
之后
[    0.000000] 554MB HIGHMEM available.

这样 000000005a200000 - 000000005bf10000之间的29M物理内存就被预留出来供我们的DMA使用了

你可能感兴趣的:(如何从linux内核--ubuntu系统cmdline上预留DDR物理内存DMA)