All of lore.kernel.org
 help / color / mirror / Atom feed
* Mapping PCIe BAR as PMEM
@ 2016-06-15 13:57 Vijairaj
  2016-06-15 14:33 ` Dan Williams
  2016-06-16  0:31 ` Logan Gunthorpe
  0 siblings, 2 replies; 3+ messages in thread
From: Vijairaj @ 2016-06-15 13:57 UTC (permalink / raw)
  To: linux-nvdimm

Hi,
I am running the 4.4 kernel on AMD64 and was wondering what's a good way of
mapping the 16M of battery backed SRAM on a custom PCIe card as PMEM. Once
mapped, I will create a file system on the block device.

I am thinking about doing the following:
    - Use the kernel parameter memmap=nn!ss to reserve the PCIe BAR
    - Write a PCI driver to enable the PCI device `pci_enable_device()`
    - Load the PCI driver
    - Load the nd_pmem driver

Is this sufficient or is there anything else required to be done in the PCI
driver?

thanks,
Vijairaj
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Mapping PCIe BAR as PMEM
  2016-06-15 13:57 Mapping PCIe BAR as PMEM Vijairaj
@ 2016-06-15 14:33 ` Dan Williams
  2016-06-16  0:31 ` Logan Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Williams @ 2016-06-15 14:33 UTC (permalink / raw)
  To: Vijairaj; +Cc: linux-nvdimm@lists.01.org

On Wed, Jun 15, 2016 at 6:57 AM, Vijairaj <vijairaj.r@gmail.com> wrote:
> Hi,
> I am running the 4.4 kernel on AMD64 and was wondering what's a good way of
> mapping the 16M of battery backed SRAM on a custom PCIe card as PMEM. Once
> mapped, I will create a file system on the block device.
>
> I am thinking about doing the following:
>     - Use the kernel parameter memmap=nn!ss to reserve the PCIe BAR

You don't need memmap= because the kernel can discover the PCIe BAR
like any other pci device (i.e. with a struct pci_device_id table).

>     - Write a PCI driver to enable the PCI device `pci_enable_device()`
>     - Load the PCI driver
>     - Load the nd_pmem driver

The pmem driver will load automatically if you register a pmem region
with nvdimm_pmem_region_create().

> Is this sufficient or is there anything else required to be done in the PCI
> driver?

Take a look at drivers/nvdimm/e820.c and copy/convert it into
drivers/nvdimm/pci.c.

One thing to note is that a PCIe card is not I/O cache coherent
meaning it can't be used in the same scenarios a host
memory-controller based persistent memory.  One change you should
probably make compared to the e820 driver is to not set the
ND_REGION_PAGEMAP bit.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Mapping PCIe BAR as PMEM
  2016-06-15 13:57 Mapping PCIe BAR as PMEM Vijairaj
  2016-06-15 14:33 ` Dan Williams
@ 2016-06-16  0:31 ` Logan Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Logan Gunthorpe @ 2016-06-16  0:31 UTC (permalink / raw)
  To: Vijairaj, linux-nvdimm; +Cc: Stephen Bates

Hey Vijairaj,

This is essentially what we did with our iopmem work [1].

We wrote a PCI driver (see [2] for an example) and had a small patch to 
the kernel to enable mappings with write combining.

Logan

[1] http://www.spinics.net/lists/linux-mm/msg103990.html
[2] https://github.com/sbates130272/iopmem

On 15/06/16 07:57 AM, Vijairaj wrote:
> Hi,
> I am running the 4.4 kernel on AMD64 and was wondering what's a good way of
> mapping the 16M of battery backed SRAM on a custom PCIe card as PMEM. Once
> mapped, I will create a file system on the block device.
>
> I am thinking about doing the following:
>      - Use the kernel parameter memmap=nn!ss to reserve the PCIe BAR
>      - Write a PCI driver to enable the PCI device `pci_enable_device()`
>      - Load the PCI driver
>      - Load the nd_pmem driver
>
> Is this sufficient or is there anything else required to be done in the PCI
> driver?
>
> thanks,
> Vijairaj
> _______________________________________________
> Linux-nvdimm mailing list
> Linux-nvdimm@lists.01.org
> https://lists.01.org/mailman/listinfo/linux-nvdimm
>
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-06-16  0:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-15 13:57 Mapping PCIe BAR as PMEM Vijairaj
2016-06-15 14:33 ` Dan Williams
2016-06-16  0:31 ` Logan Gunthorpe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.