• Stephen Boyd's avatar
    i2c: i2c-qcom-geni: Properly handle DMA safe buffers · 66975767
    Stephen Boyd authored
    We shouldn't attempt to DMA map the message buffers passed into this
    driver from the i2c core unless the message we're mapping have been
    properly setup for DMA. The i2c core indicates such a situation by
    setting the I2C_M_DMA_SAFE flag, so check for that flag before using DMA
    mode. We can also bounce the buffer if it isn't already mapped properly
    by using the i2c_get_dma_safe_msg_buf() APIs, so do that when we
    want to use DMA for a message.
    
    This fixes a problem where the kernel oopses cleaning pages for a buffer
    that's mapped into the vmalloc space. The pages are returned from
    request_firmware() and passed down directly to the i2c master to write
    to the i2c touchscreen device. Mapping vmalloc buffers with
    dma_map_single() won't work reliably, causing an oops like below:
    
     Unable to handle kernel paging request at virtual address ffffffc01391d000
     ...
    Reported-by: default avatarPhilip Chen <philipchen@chromium.org>
    Signed-off-by: default avatarStephen Boyd <swboyd@chromium.org>
    Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
    Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
    66975767
i2c-qcom-geni.c 17.9 KB