title: Interfacing a linux device driver with dummy PCI device
body: <p>I have a user space program that simulates a PCI device. I have downloaded the nvme linux device driver that interacts with the PCI device using the NVMe standard. I have to verify that my userspace program is compatible with the standard. </p>
  
  <p>The nvme.c(the linux device driver) contains the nvme_probe() function that would be called when the device is plugged in. Since I do not have the device so I think I will incorporate the probe functionality in nvme_init() function. </p>
  
  <p>Now I have studied quite a lot on the internet to understand how to emulate a PCI device, posts such as 
      <a href="https://stackoverflow.com/questions/12714555/installing-linux-pci-driver-without-connecting-the-device">Installing PCI driver without connection to device</a>,
  <a href="http://www.linuxquestions.org/questions/linux-kernel-70/how-to-emulate-a-pci-device-in-linux-901554/" rel="nofollow noreferrer">emulating a PCI device on linux</a>
  I do not get the idea how to return the populated struct pci_dev to the  function call in the <code>nvme_probe()</code> of<code>pci_set_drvdata(pdev, dev);</code></p>
  
  <p>And if you could suggest a tutorial, on how to manually populate the pci_dev struct with dummy device configuration and memory address of the userspace program function pointers to emulate interaction with the nvme driver.</p>