[Nouveau] NV43 + PPC64 = :(
Benjamin Herrenschmidt
benh at kernel.crashing.org
Fri Jul 13 15:35:33 PDT 2007
> However, during X-server start up, the system hard-locks. Since Apple
> systems don't have a reset button (sigh...), I have to power-cycle the
> machine. I cannot ssh into the machine, and it's not pingable. It's
> really toast. I've attached a log with DRM debug messages. The bits
> about "iommu_alloc failed" seem suspicious to me.
Yup, that means the dma-mapping failed. What are you trying to map ? I
see a lot of attempts at mapping 524288 pages which looks very wrong to
me. The G5 is an iommu space configured to 2GB so I doubt it would run
out that easily, I suspect you are not passing the wrong page count to
pci_map_* or you are not terminating your sg list properly.
> I don't have another system with an Nvidia card to test. I'd appreciate
> it if someone could test this patch on x86 or x86-64 and report results
> back. I'd like to determine if the patch is broken, just broken on
> PPC64, or if something else is broken.
The use of virt_to_bus is generally broken, so nouveau needs to be
adapted to use DMA mappings.
Looking at the patch...
+ dev->sg->busaddr[idx] =
+ pci_map_page(dev->pdev,
+ dev->sg->pagelist[idx],
+ 0,
+ DMA_31BIT_MASK,
+ DMA_BIDIRECTIONAL);
+
+ if (dev->sg->busaddr[idx] == 0) {
+ return DRM_ERR(ENOMEM);
The above error checking is incorrect. You need to use dma_mapping_error()
on the resulting bus address to check for errors. (0 is a valid DMA
address actually, we use ~0 to indicate errors).
Also, you are passing "DMA_31BIT_MASK" to the "size" argument of
dma_map_page() which is what's causing the error in the fist place :-) If
you are mapping one page, you should pass PAGE_SIZE there.
If you have constraints for those to be in the 31 bits space, you need to
set those with your device DMA mask (but on the G5, iommu allocs are always
in 31 bits space anyway so you are safe there).
Also, if you're building an sglist, you shouldn't have to call dma_map_page
for every page. Just fill an sglist and call pci_map_sg(). The iommu code will
do virtual merging, that is, it will potentially return less entries than
what you passed in, as it will attempt to virtually merge the pages in
the DMA space (thus allowing you to create smaller scatter/gather list in
your HW, which is generally more efficient).
Cheers,
Ben.
More information about the Nouveau
mailing list