how to make PCI(E) device memory appear as main memory - Linux

This is a discussion on how to make PCI(E) device memory appear as main memory - Linux ; sorry if the question is ignorant. how difficult would it be to create a kernel module that instructs the kernel memory manager to treat the memory space of a PCI or PCI Express device as main memory, i.e. feeding it ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: how to make PCI(E) device memory appear as main memory

  1. how to make PCI(E) device memory appear as main memory

    sorry if the question is ignorant. how difficult would it be to create
    a kernel module that instructs the kernel memory manager to treat the
    memory space of a PCI or PCI Express device as main memory, i.e.
    feeding it through the virtual memory allocation engine and passing on
    to user-mode applications?

    any advice is much appreciated. if not a direct answer, then perhaps
    at least a pointer towards the kernel functions of interest...

    thanks in advance


  2. Re: how to make PCI(E) device memory appear as main memory

    maxim.adelman@gmail.com wrote:
    > sorry if the question is ignorant. how difficult would it be to create
    > a kernel module that instructs the kernel memory manager to treat the
    > memory space of a PCI or PCI Express device as main memory, i.e.
    > feeding it through the virtual memory allocation engine and passing on
    > to user-mode applications?
    >
    > any advice is much appreciated. if not a direct answer, then perhaps
    > at least a pointer towards the kernel functions of interest...
    >
    > thanks in advance
    >


    Probably what you want is to implement mmap for the device. This allows
    user space apps to map your PCIe memory into user space. There are
    examples of this in the Rubini book (see remap_page_range, remap_pfn_range).

    John

  3. Re: how to make PCI(E) device memory appear as main memory

    John Fusco wrote:
    > Probably what you want is to implement mmap for the device. This allows
    > user space apps to map your PCIe memory into user space. There are
    > examples of this in the Rubini book (see remap_page_range, remap_pfn_range).


    That I've already done. But, I actually want PCIe memory to be treated
    by the kernel as main memory. I.e. be part of the main memory pool
    from which memory is allocated to user programs, etc. Concerns about
    latency and bandwidth aside notwithstanding...


  4. Re: how to make PCI(E) device memory appear as main memory

    maxim.adelman@gmail.com wrote:
    > John Fusco wrote:
    >> Probably what you want is to implement mmap for the device. This allows
    >> user space apps to map your PCIe memory into user space. There are
    >> examples of this in the Rubini book (see remap_page_range, remap_pfn_range).

    >
    > That I've already done. But, I actually want PCIe memory to be treated
    > by the kernel as main memory. I.e. be part of the main memory pool
    > from which memory is allocated to user programs, etc. Concerns about
    > latency and bandwidth aside notwithstanding...
    >


    I'm not aware of any straightforward way to do that in the kernel.

    I believe you'll find that using the PCI bus for expansion memory is
    generally discouraged.

    Good luck.

    JF

+ Reply to Thread