tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pci_dma64_available() and Xen



On Sat, Oct 11, 2008 at 11:18:40PM +0200, Joerg Sonnenberger wrote:
> On Sat, Oct 11, 2008 at 10:58:54PM +0200, Manuel Bouyer wrote:
> > This is wrong for Xen, where a domain may have less than 4GB allocated,
> > but its memory is above the 4GB limit. More generally, this seems to
> > assume that the physical memory is contigous, which I feel is wrong for a
> > MI piece of code.
> 
> It doesn't have to be contigous, but I think all practical platforms
> have it semi-contiguous from low addresses. The test is bogus, but not
> useless. The intention is to avoid the overhead of 64bit DMA if all bus
> addresses will be below 4GB. physmem a good approximation for most

What overhead are we talking about ?
All drivers I've checked (grep -l dmat64 sys/dev/pci/*) have to write the
64bit addresses to registers and descriptor anyway. I guess doing the
shift/mask if faster than a test to know if we have to write 0 or do
the shift/mask of the upper part of the address (not talking about
devices that have true 64bit addresses, which care even less).
Some do things differenty at compile time based on sizeof(bus_addr_t),
but none do it at runtime.

> cases, but of course not correct. Best approach is to likely make it a
> global variable (pci_prefer_32bit) for 64bit platforms to express the
> intend. Just removing the conditional is not good though.

I don't think it's worth it, and nothing use it this way right now
(and I can't think of a case where it would be used this way: the run-time
check is more expensive than the extra 32bits write).
And we don't need a global variable for this: just make the dmat64 invalid
in MD code if we want to.

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--


Home | Main Index | Thread Index | Old Index