• Miodrag Dinic's avatar
    tty: goldfish: Use streaming DMA for r/w operations on Ranchu platforms · 7157d2be
    Miodrag Dinic authored
    Implement tty r/w operations using streaming DMA.
    
    Goldfish tty for Ranchu platforms has been modified to use
    streaming DMA mappings for read/write operations. This change
    eliminates the need for snooping through the TLB in QEMU using
    cpu_get_phys_page_debug() which does not guarantee that it will
    return the valid va -> pa mapping.
    
    The streaming DMA mapping is implemented using dma_map_single() per
    transfer, while dma_unmap_single() is used for unmapping right after
    the DMA transfer.
    
    Using DMA API is the proper way for handling r/w transfers and
    makes this driver more portable, thus effectively eliminating
    the need for virt_to_page() and page_to_phys() conversions.
    
    This change does not affect the old style Goldfish tty behaviour
    which is still used by the Goldfish emulator. Version register has
    been added and probed to see which platform is running this driver.
    Reading from the new register GOLDFISH_TTY_REG_VERSION using the
    Goldfish emulator will return 0 and driver will work with virtual
    addresses. Whereas if run on Ranchu it returns 1, and thus DMA is
    used.
    
    (Goldfish and Ranchu are code names for the first and the second
    generation of virtual boards used by Android emulator.)
    Signed-off-by: default avatarMiodrag Dinic <miodrag.dinic@imgtec.com>
    Signed-off-by: default avatarGoran Ferenc <goran.ferenc@imgtec.com>
    Signed-off-by: default avatarAleksandar Markovic <aleksandar.markovic@imgtec.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    7157d2be
goldfish.c 11.6 KB