[lkml]   [2001]   [Oct]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: how to get virtual address from dma address


    > Worse still, every driver that needs this feature is doing it on its own, so
    > the code for doing this in usb-ohci is different from the code in the
    > sym53c8xx driver etc. We're now duplicating this fairly subtle and complex
    > code all over the driver base.

    What's complex??

    The sym53c8xx driver uses a simple hash table to retrieve the IO control
    block from the DSA value. This DSA value is in fact the bus physical
    address. Indeed, this is kind of reverse mapping DMA address -> Virtual
    address, but the code is about 20 lines _only_, and it is absolutely not
    complex, neither it impacts performances nor makes significant difference
    about memory used. The driver could, for example, use a simple index
    instead and retrieve the IO control block from an array of virtual
    addresses, as does the aic7xxx driver, for example. This simple reverse
    mapping seemed to me more appropriate for the sym53c8xx stuff.

    In my opinion, any bus_to_virt() thing hurts a lot. It only makes sense if
    it refers to the virt_to_bus() mapping that was used to generate the bus
    address and assumes the reverse function to be a mapping. A general
    bus_to_virt() thing looks so ugly thing to me that I donnot want to ever
    use such. Even if we implicitely assume that it refers to some 'virtual to
    DMA mapping' that ensures that each virtual address only maps a single DMA
    address, it may be trivial to implement on some arch with no significant
    overhead but it can be complex to implement on some other or may suffer of
    significant overhead.

    Frankly, I definitely would not like any general bus_to_virt() to be

    By the way, what is a bit complex in the sym53c8xx driver is probably the
    memory allocator that provides virtual to bus address mapping for internal
    driver data structures + naturally aligned allocations. I wrote it once
    and now it is also useful for SYM-2 that runs on 3 O/Ses. I haven't had
    any problem with that code since day one, so I will keep with it even if
    some O/S does provide an equivalent service. :-)



    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 13:04    [W:0.025 / U:39.180 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site