Force Linux to use only memory over 4G?

后端 未结 2 1357
面向向阳花
面向向阳花 2020-12-31 16:51

I have a Linux device driver that interfaces to a device that, in theory, can perform DMA using 64-bit addresses. I\'d like to test to see that this actually works.

相关标签:
2条回答
  • 2020-12-31 17:20

    IIRC there's an option within kernel configuration to use PAE extensions which will enable you to use more than 4GB (I am a bit rusty on the kernel config - last kernel I recompiled was 2.6.4 - so please excuse my lack of recall). You do know how to trigger a kernel config

    make clean && make menuconfig

    Hope this helps, Best regards, Tom.

    0 讨论(0)
  • 2020-12-31 17:37

    /usr/src/linux/Documentation/kernel-parameters.txt

            memmap=exactmap [KNL,X86] Enable setting of an exact
                            E820 memory map, as specified by the user.
                            Such memmap=exactmap lines can be constructed based on
                            BIOS output or other requirements. See the memmap=nn@ss
                            option description.
    
            memmap=nn[KMG]@ss[KMG]
                            [KNL] Force usage of a specific region of memory
                            Region of memory to be used, from ss to ss+nn.
    
            memmap=nn[KMG]#ss[KMG]
                            [KNL,ACPI] Mark specific memory as ACPI data.
                            Region of memory to be used, from ss to ss+nn.
    
            memmap=nn[KMG]$ss[KMG]
                            [KNL,ACPI] Mark specific memory as reserved.
                            Region of memory to be used, from ss to ss+nn.
                            Example: Exclude memory from 0x18690000-0x1869ffff
                                     memmap=64K$0x18690000
                                     or
                                     memmap=0x10000$0x18690000

    If you add memmap=4G$0 to the kernel's boot parameters, the lower 4GB of physical memory will no longer be accessible. Also, your system will no longer boot... but some variation hereof (memmap=3584M$512M?) may allow for enough memory below 4GB for the system to boot but not enough that your driver's DMA buffers will be allocated there.

    0 讨论(0)
提交回复
热议问题