Dan, thank you.

Yes that is true but PCIe memory (assuming a PCIe BAR is backed by real memory 
and not just registers) never participated in cache coherence anyways.
So assuming my applications using /dev/dax0.0 character device were aware of 
this feature (or lack of it), would this implementation be the correct way to 
do it?

Thanks,
AneeshS

-----Original Message-----
From: Dan Williams <[email protected]> 
Sent: Tuesday, April 26, 2022 4:24 PM
To: An Sarpal <[email protected]>
Cc: [email protected]
Subject: Re: How to map my PCIe memory as a devdax device (/dev/daxX.Y)

On Tue, Apr 26, 2022 at 1:58 PM An Sarpal <[email protected]> wrote:
>
> I have a PCIe FPGA device (single function) that has a 2GB RAM mapped via a 
> single 64-bit PCIe BAR of length 2GB.
>
> I would like to make this memory available as /dev/daxX.Y character device so 
> some applications that I already have that work with these character devices 
> can be used.
>
> I am thinking of modifying drivers/dax/device.c for my implementation.
>
> To test drivers/dax/device.c, I added memmap to my kernel command line and 
> rebooted. I noticed I have /dev/pmem0 of the same length show up. ndctl shows 
> this device. This is obviously of type fsdax.
> I then ran ndctl create-namespace -mem=devdax on this device which converted 
> it to /dev/daxX.Y.
>
> When I ran ndctl that converted from fsdax to devdax, I noticed that the 
> probe routine was called with the base and length as expected.
>
> So I am hoping using drivers/dax/device.c is the best way to go to expose my 
> PCIe memory as /dev/daxX.Y.

That will give the *appearance* that a PCI BAR is acting as memory, but it will 
break in subtle and unpredictable ways due to the lack of cache coherence for 
PCI memory. So there is no way to safely expose PCIe memory as general "System 
RAM" like other DDR.

Reply via email to