[openib-general] svn patches.
Roland Dreier
Wed Apr 28 15:12:28 PDT 2004
Greg> The proper pci_register_driver() interface is what you need
Greg> to do. That works just fine for 2.4 and 2.6, and will
Greg> handle all of the hotplug issues properly.
Right, but the HCA HW driver has to have an interface to give the
device pointer to upper-level protocols like SRP.
Roland> In fact that's one of the things that I'm trying to figure
Roland> out how to do in a way portable between 2.4 and 2.6. For
Roland> 2.6 we clearly want to just use a struct device * (since
Roland> there are devices we care about on things like a PPC4xx
Roland> EPB rather than PCI), but the device model and generic DMA
Roland> mapping API doesn't exist on 2.4.
Greg> And it will not ever get backported either (for good reason,
Greg> 2.4 development is over.) So, I was just lucky in finding
Greg> the main reason why 2.4 support is going to be almost
Greg> impossible? :)
You picked a good one :) Now that I think about it though, for 2.4 I
think we can get away with just giving a PCI device pointer but
calling it a struct device *. Then we just have to add trivial DMA
API wrappers around PCI DMA API functions in our ib_kcompat module.
Roland> Hotplug is an even bigger can of worms. I don't know what
Roland> the heck we do for stuff like userspace processes that
Roland> have registered memory with an HCA that is no longer
Roland> attached to the system.
Greg> If you use pci_register_driver() everything will work just
Greg> fine. The driver has to tell userspace that it's resources
Greg> are now gone just before the card goes away, just like it
Greg> happens if you unload the module.
But the card can now go away with a nonzero reference count...
With typical hotplug PCI hardware, what happens to a userspace process
that writes to a PCI devices mmio region after the device is no longer
there? Is the write silently discarded or does the process get some
sort of fault?
Greg> Also, why is the memory model backwards from the traditional
Greg> Unix mmap model? (kernel gives out the memory to the user,
Greg> the user never gives a memory chunk to the kernel.) Is
Greg> there some IB reason for this that I'm missing?
Unfortunately this is deeply embedded in the IB spec. A userspace
consumer can call the register memory verb on any virtual address
space it owns. It does make sense too: otherwise the IB driver ends
up reinventing interfaces to give user processes hugetlb pages, etc.
- Roland
--
To unsubscribe send an email with subject unsubscribe to openib-general at openib.org.
Please contact moderator at openib.org for questions.
More information about the openib-general mailing list